27 lines
531 B
TypeScript
27 lines
531 B
TypeScript
"use client"
|
|
import { usePathname } from "next/navigation"
|
|
|
|
import { linkVariants } from "./variants"
|
|
|
|
import NextLink from "next/link"
|
|
|
|
import type { LinkProps } from "./link"
|
|
|
|
export default function Link({
|
|
className,
|
|
href,
|
|
size,
|
|
variant,
|
|
...props
|
|
}: LinkProps) {
|
|
const currentPageSlug = usePathname()
|
|
const isActive = currentPageSlug === href
|
|
const classNames = linkVariants({
|
|
active: isActive,
|
|
className,
|
|
size,
|
|
variant,
|
|
})
|
|
return <NextLink className={classNames} href={href} {...props} />
|
|
}
|