import { useNavigate, useNavigation } from "@remix-run/react"; import { Button } from "~/components/ui/button"; import { ArrowLeft, ArrowRight } from "lucide-react"; import { SidebarTrigger } from "~/components/ui/sidebar"; export interface BreadcrumbItem { label: string | React.ReactNode; href?: string; } export interface PageHeaderAction { label: string; icon?: React.ReactNode; onClick: () => void; variant?: "default" | "secondary" | "outline" | "ghost"; } export interface PageHeaderTab { label: string; value: string; isActive: boolean; onClick: () => void; } export interface PageHeaderProps { title: string; breadcrumbs?: BreadcrumbItem[]; actions?: PageHeaderAction[]; actionsNode?: React.ReactNode; tabs?: PageHeaderTab[]; showTrigger?: boolean; } // Back and Forward navigation component function NavigationBackForward() { const navigate = useNavigate(); return (
); } export function PageHeader({ title, breadcrumbs, actions, tabs, showTrigger = true, actionsNode, }: PageHeaderProps) { const navigation = useNavigation(); const navigate = useNavigate(); const isLoading = navigation.state === "loading" || navigation.state === "submitting"; return (
{/* Keyframes for the loading bar animation */}
{showTrigger && } {/* Breadcrumbs */} {breadcrumbs && breadcrumbs.length > 0 ? ( ) : (

{title}

)} {/* Tabs */} {tabs && tabs.length > 0 && (
{tabs.map((tab) => ( ))}
)}
{/* Actions */} {actions && actions.length > 0 && (
{actions.map((action, index) => ( ))}
)} {actionsNode && actionsNode}
{isLoading && (
); }