Files
role-user/src/components/filter-nav.tsx
T
2026-06-02 14:46:39 +08:00

36 lines
783 B
TypeScript

import Link from "next/link";
import type { Route } from "next";
import type { CSSProperties } from "react";
type FilterNavOption = {
href: Route;
label: string;
active: boolean;
};
type FilterNavProps = {
label: string;
options: FilterNavOption[];
};
export function FilterNav({ label, options }: FilterNavProps) {
return (
<nav
aria-label={label}
className="segmented"
style={{ "--segment-count": options.length } as CSSProperties}
>
{options.map((option) => (
<Link
aria-current={option.active ? "page" : undefined}
className={option.active ? "is-active" : undefined}
href={option.href}
key={option.label}
>
{option.label}
</Link>
))}
</nav>
);
}