Skip to content

Commit 7d9067b

Browse files
WesSouzaarturbien
authored andcommitted
refactor(anchor): add underline property, default true
1 parent 74f56ec commit 7d9067b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Anchor/Anchor.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ import { CommonStyledProps } from '../types';
55

66
type AnchorProps = {
77
children: React.ReactNode;
8+
underline?: boolean;
89
} & React.AnchorHTMLAttributes<HTMLAnchorElement> &
910
CommonStyledProps;
1011

1112
const StyledAnchor = styled.a<{ underline: boolean }>`
1213
color: ${({ theme }) => theme.anchor};
1314
font-size: inherit;
14-
text-decoration: underline;
15+
text-decoration: ${({ underline }) => (underline ? 'underline' : 'none')};
1516
&:visited {
1617
color: ${({ theme }) => theme.anchorVisited};
1718
}
1819
`;
1920

2021
const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(
21-
({ children, ...otherProps }: AnchorProps, ref) => {
22+
({ children, underline = true, ...otherProps }: AnchorProps, ref) => {
2223
return (
23-
<StyledAnchor ref={ref} {...otherProps}>
24+
<StyledAnchor ref={ref} underline={underline} {...otherProps}>
2425
{children}
2526
</StyledAnchor>
2627
);

0 commit comments

Comments
 (0)