import type { ReactNode } from 'react'; import { Link } from 'react-router-dom'; import { ArrowLeft, X } from 'lucide-react'; import { buttonVariants } from './button'; import { H2, H3, Muted } from './typography'; import { cn } from '../../lib/utils'; /* Page header: title + optional badge, actions on the right (stacks on mobile) */ export function PageHeader({ title, leading, badge, actions, }: { title: string; /** Element przed tytułem (np. awatar). */ leading?: ReactNode; badge?: ReactNode; actions?: ReactNode; }) { return (
{leading} {/* `

` należy do topbaru (tytuł strony) — nagłówek treści to `

` */}

{title}

{badge}
{actions}
); } /* Back button — ghost, small; `to` renders a Link, `onClick` a plain button */ export function BackButton({ to, onClick, children = 'Wstecz', className = '', }: { to?: string; onClick?: () => void; children?: ReactNode; className?: string; }) { // na telefonie „Wstecz” siedzi w topmenu („<”) — tu tylko md+ const cls = cn(buttonVariants({ variant: 'ghost', size: 'sm' }), 'max-md:hidden', className); if (to) { return ( {children} ); } return ( ); } /* Section header: H2 + muted description + optional actions (right) */ export function SectionHeader({ title, description, actions, className = '', }: { title: ReactNode; description?: ReactNode; actions?: ReactNode; className?: string; }) { return (

{title}

{description && {description}}
{actions &&
{actions}
}
); } /* Meta item: small icon + muted text */ export function MetaItem({ icon: Icon, children, className = '', }: { icon: React.ComponentType<{ className?: string }>; children: ReactNode; className?: string; }) { return ( {children} ); } /* List row: płaski wiersz (tytuł + meta lewo, akcje prawo); w listach w karcie rodzic używa `divide-y divide-line` (dłuższe) albo `space-y-1` (krótkie). */ export function ListRow({ title, meta, actions, children, className = '', }: { title: ReactNode; meta?: ReactNode; actions?: ReactNode; children?: ReactNode; className?: string; }) { return (
{title}
{meta && {meta}}
{actions &&
{actions}
} {children}
); } /* Chip: small pill (+ optional remove button) */ export function Chip({ children, onRemove, removeLabel = 'Usuń', className = '', }: { children: ReactNode; onRemove?: () => void; removeLabel?: string; className?: string; }) { return ( {children} {onRemove && ( )} ); } /* Empty state */ export function EmptyState({ icon: Icon, title, description, action, }: { icon: React.ComponentType<{ className?: string }>; title: string; description?: string; action?: ReactNode; }) { return (

{title}

{description &&

{description}

} {action &&
{action}
}
); } /* Tabs */ export function Tabs({ tabs, active, onChange, }: { tabs: { id: string; label: string }[]; active: string; onChange: (id: string) => void; }) { return (
{tabs.map((t) => ( ))}
); }