feat (v1.0.0): initial refactor and redesign
This commit is contained in:
parent
3058aa1ab4
commit
fe9b50b30e
134 changed files with 17792 additions and 3670 deletions
|
|
@ -1,22 +1,42 @@
|
|||
import { default as NextLink } from 'next/link'
|
||||
import { cn } from '@/lib/theme'
|
||||
import { externalLinkProps } from '@/lib/utils/styles'
|
||||
|
||||
interface LinkProps {
|
||||
href: string
|
||||
className?: string
|
||||
target?: string
|
||||
rel?: string
|
||||
variant?: 'default' | 'nav' | 'muted'
|
||||
external?: boolean
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export default function Link(props: LinkProps) {
|
||||
export default function Link({
|
||||
href,
|
||||
className,
|
||||
target,
|
||||
rel,
|
||||
variant = 'default',
|
||||
external,
|
||||
children
|
||||
}: LinkProps) {
|
||||
const isExternal = external || href.startsWith('http')
|
||||
|
||||
const variantStyles = {
|
||||
default: 'text-blue-400 hover:underline',
|
||||
nav: 'text-gray-300 hover:text-white',
|
||||
muted: 'text-gray-400 hover:text-gray-300'
|
||||
}
|
||||
|
||||
return (
|
||||
<NextLink
|
||||
href={props.href}
|
||||
className={`text-blue-400 hover:underline ${props.className}`}
|
||||
target={props.target}
|
||||
rel={props.rel}
|
||||
href={href}
|
||||
className={cn(variantStyles[variant], className)}
|
||||
target={target || (isExternal ? externalLinkProps.target : undefined)}
|
||||
rel={rel || (isExternal ? externalLinkProps.rel : undefined)}
|
||||
>
|
||||
{props.children}
|
||||
{children}
|
||||
</NextLink>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue