-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added external link icon #4757
Changes from 4 commits
e2f5522
085c519
c6d775b
0cbfb8e
e9f156e
318e9a6
0aee71f
4e4ff7a
9cf0869
f57b263
271658b
5309237
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import { classNames } from '@aws-amplify/ui'; | ||
import { ComponentClassName } from '@aws-amplify/ui'; | ||
import { View } from '../../View'; | ||
import { InternalIcon } from './types'; | ||
/** | ||
* @internal For internal Amplify UI use only. May be removed in a future release. | ||
*/ | ||
export const IconBoxArrowUpRight: InternalIcon = (props) => { | ||
const { className, ...rest } = props; | ||
return ( | ||
<View | ||
as="span" | ||
width="1em" | ||
height="1em" | ||
className={classNames(ComponentClassName.Icon, className)} | ||
{...rest} | ||
> | ||
<svg | ||
width="24" | ||
height="24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="currentColor" | ||
viewBox="0 0 24 24" | ||
> | ||
<path | ||
fill="evenodd" | ||
d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z" | ||
/> | ||
<path | ||
fill="evenodd" | ||
d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z" | ||
/> | ||
</svg> | ||
</View> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import * as React from 'react'; | ||
import { classNames } from '@aws-amplify/ui'; | ||
|
||
import { ComponentClassName } from '@aws-amplify/ui'; | ||
import { ComponentClassName, classNames } from '@aws-amplify/ui'; | ||
import { | ||
BaseLinkProps, | ||
LinkProps, | ||
|
@@ -10,6 +8,7 @@ import { | |
} from '../types'; | ||
import { View } from '../View'; | ||
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef'; | ||
import { IconBoxArrowUpRight } from '../Icon/icons/IconBoxArrowUpRight'; | ||
|
||
const LinkPrimitive: Primitive<LinkProps, 'a'> = ( | ||
{ as = 'a', children, className, isExternal, ...rest }, | ||
|
@@ -25,6 +24,7 @@ const LinkPrimitive: Primitive<LinkProps, 'a'> = ( | |
{...rest} | ||
> | ||
{children} | ||
{isExternal && <IconBoxArrowUpRight />} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Few things here:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sure, but what if the link is external and i don't want the icon?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call on RTL languages. I'll work on adding a position prop, so devs can control the icon position There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lavr001 The above question is still unanswered:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @calebpollman Are you suggesting having a new prop called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @calebpollman Added new prop |
||
</View> | ||
); | ||
}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where did this icon come from and why is it not centered like the other icons? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we don't typically use icons from the external libraries, I just looked online for a SVG path that forms the icon. I've added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using a specific icon set from material, so we should be consistent and use the same one for this too. @dbanksdesign Do you remember which version we were using? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked SVG icons from material and they didn't really have a specific external link icon, so I grabbed another SVG There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this SVG taken from and what was the reasoning used in choosing it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I simply googled svg path for external icon, since we don't usually pull in icons from an external source. Not sure what do you mean by reasoning. Are you suggesting some other approaches here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only be a single import line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unresolved, there are two import lines for the same package still. In the future, please refrain from resolving a conversation until the feedback has been addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there are two import lines for the same package across multiple primitives, I'll make sure to make it one line when done with other updates on this PR.