Files
web/components/TempDesignSystem/Link/index.tsx
2024-04-16 09:24:31 +02:00

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} />
}