Skip to content

Commit

Permalink
refactor(anchor): add underline property, default true
Browse files Browse the repository at this point in the history
  • Loading branch information
WesSouza authored and arturbien committed Aug 5, 2022
1 parent 74f56ec commit 7d9067b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Anchor/Anchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ import { CommonStyledProps } from '../types';

type AnchorProps = {
children: React.ReactNode;
underline?: boolean;
} & React.AnchorHTMLAttributes<HTMLAnchorElement> &
CommonStyledProps;

const StyledAnchor = styled.a<{ underline: boolean }>`
color: ${({ theme }) => theme.anchor};
font-size: inherit;
text-decoration: underline;
text-decoration: ${({ underline }) => (underline ? 'underline' : 'none')};
&:visited {
color: ${({ theme }) => theme.anchorVisited};
}
`;

const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(
({ children, ...otherProps }: AnchorProps, ref) => {
({ children, underline = true, ...otherProps }: AnchorProps, ref) => {
return (
<StyledAnchor ref={ref} {...otherProps}>
<StyledAnchor ref={ref} underline={underline} {...otherProps}>
{children}
</StyledAnchor>
);
Expand Down

0 comments on commit 7d9067b

Please sign in to comment.