Files
link-free/src/components/Link/index.tsx
T

20 lines
496 B
TypeScript
Raw Normal View History

2021-12-11 13:42:11 -03:00
import NextLink from 'next/link'
2021-12-13 17:12:51 -03:00
import type { AnchorHTMLAttributes } from 'react'
2021-12-11 13:42:11 -03:00
2021-12-13 17:12:51 -03:00
import type { LinkVariantProps } from './styles'
import { Wrapper } from './styles'
2021-12-11 13:42:11 -03:00
2021-12-13 17:12:51 -03:00
export type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
href: string
theme?: LinkVariantProps['theme']
}
2021-12-11 13:42:11 -03:00
2021-12-13 17:12:51 -03:00
export function Link({ href, theme, ...rest }: LinkProps) {
2021-12-11 13:42:11 -03:00
return (
<NextLink href={href} passHref>
2021-12-13 17:12:51 -03:00
<Wrapper theme={theme} {...rest} />
2021-12-11 13:42:11 -03:00
</NextLink>
)
}
2021-12-13 17:12:51 -03:00
export type { LinkVariantProps }