import Link from "next/link"; import { forwardRef } from "react"; import type { ReactNode } from "react"; import { IconArrowLeft } from "@tabler/icons-react"; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "@kandev/ui/breadcrumb"; import { cn } from "@kandev/ui/lib/utils"; type PageTopbarProps = { /** Page title shown in the breadcrumb */ title: string; /** Optional subtitle shown to the right of the title */ subtitle?: string; /** Optional icon rendered before the title */ icon?: ReactNode; /** Where the back link navigates to (default: "/") */ backHref?: string; /** Label for the parent breadcrumb (default: "KanDev") */ backLabel?: string; /** Optional content rendered before the breadcrumb */ leading?: ReactNode; /** Optional content rendered at the visual center of the topbar */ center?: ReactNode; /** Optional content rendered alongside the left orientation label */ leftActions?: ReactNode; /** Optional content rendered on the right side of the topbar */ actions?: ReactNode; variant?: "breadcrumb" | "root"; className?: string; centerClassName?: string; actionsClassName?: string; }; export const PageTopbar = forwardRef(function PageTopbar( { title, subtitle, icon, backHref = "/", backLabel = "KanDev", leading, center, leftActions, actions, variant = "breadcrumb", className, centerClassName, actionsClassName, }, ref, ) { return (
{leading} {variant === "root" ? (
{backLabel}
) : ( {backLabel} {icon} {title} {subtitle && ( <> ยท {subtitle} )} )} {leftActions && (
{leftActions}
)} {center && (
{center}
)} {actions && (
{actions}
)}
); });