Skip to content

Commit

Permalink
Fix Link containsIcon specificity (#38)
Browse files Browse the repository at this point in the history
Fix Link containsIcon specificity
  • Loading branch information
domyen authored Jun 27, 2019
2 parents f303fe7 + 0bc88ca commit 9c5fd96
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ const linkStyles = css`
margin-right: 0.4em;
}
${props =>
props.containsIcon &&
css`
svg {
height: 1em;
width: 1em;
vertical-align: middle;
position: relative;
bottom: 0;
margin-right: 0;
}
`};
${props =>
props.secondary &&
css`
Expand Down Expand Up @@ -112,19 +125,6 @@ const LinkInner = styled.span`
vertical-align: inherit;
}
`};
${props =>
props.containsIcon &&
css`
svg {
height: 1em;
width: 1em;
vertical-align: middle;
position: relative;
bottom: 0;
margin-right: 0;
}
`};
`;

const LinkA = styled.a`
Expand All @@ -147,10 +147,10 @@ const LinkButton = styled.button`
/**
* Links can contains text and/or icons. Be careful using only icons, you must provide a text alternative via aria-label for accessibility.
*/
export function Link({ isButton, withArrow, containsIcon, LinkWrapper, children, ...rest }) {
export function Link({ isButton, withArrow, LinkWrapper, children, ...rest }) {
const content = (
<Fragment>
<LinkInner withArrow={withArrow} containsIcon={containsIcon}>
<LinkInner withArrow={withArrow}>
{children}
{withArrow && <Icon icon="arrowright" />}
</LinkInner>
Expand All @@ -159,7 +159,7 @@ export function Link({ isButton, withArrow, containsIcon, LinkWrapper, children,

if (LinkWrapper) {
const StyledLinkWrapper = styled(
({ inverse, nochrome, secondary, tertiary, ...linkWrapperRest }) => (
({ containsIcon, inverse, nochrome, secondary, tertiary, ...linkWrapperRest }) => (
<LinkWrapper {...linkWrapperRest} />
)
)`
Expand Down

0 comments on commit 9c5fd96

Please sign in to comment.