feat: breadcrumbs for My Pages

This commit is contained in:
Simon Emanuelsson
2024-04-11 18:51:38 +02:00
parent 33b4d1d9fc
commit 38f764e0ff
31 changed files with 228 additions and 87 deletions

View File

@@ -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,

View File

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