feat: breadcrumbs for My Pages
This commit is contained in:
@@ -10,12 +10,16 @@ import type { LinkProps } from "./link"
|
||||
export default function Link({
|
||||
className,
|
||||
href,
|
||||
partialMatch = false,
|
||||
size,
|
||||
variant,
|
||||
...props
|
||||
}: LinkProps) {
|
||||
const currentPageSlug = usePathname()
|
||||
const isActive = currentPageSlug === href
|
||||
let isActive = currentPageSlug === href
|
||||
if (partialMatch && !isActive) {
|
||||
isActive = currentPageSlug.startsWith(href)
|
||||
}
|
||||
const classNames = linkVariants({
|
||||
active: isActive,
|
||||
className,
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
export interface LinkProps
|
||||
extends React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
||||
VariantProps<typeof linkVariants> {
|
||||
VariantProps<typeof linkVariants> {
|
||||
href: string
|
||||
partialMatch?: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user