Skip to content

Commit

Permalink
fix: remove magic and always use an a component unless caller speci…
Browse files Browse the repository at this point in the history
…fies something else
  • Loading branch information
maxholman committed Dec 26, 2022
1 parent 9c6f6ac commit 9685396
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ export const TextLink: FC<
BoxBasedComponentProps<'span' | 'a'>,
{ href?: string; weight?: LinkVariant }
>
> = ({ children, className, weight = 'standard', ...props }) => (
> = ({
component = 'a',
children,
className,
weight = 'standard',
...props
}) => (
<Box
// if someone is trying to use this as a link, use an anchor element
component={'href' in props ? 'a' : 'span'}
component={component}
className={[linkStyleVariant[weight], className]}
{...props}
>
Expand Down

0 comments on commit 9685396

Please sign in to comment.