import React, { ReactNode } from 'react'; import { ChevronLeft } from 'lucide-react'; import { Flex, FlexItem } from '../ui/flex'; import { useNavigate } from 'react-router-dom'; interface AppHeaderProps { showBackButton?: boolean; noBottomMargin?: boolean; children?: ReactNode; backTo?: string; // When provided, the Back button calls this instead of navigating - lets a dual-mode page (embedded in a // modal) return to its in-modal list rather than changing the route. Absent = the normal routed behavior. onBack?: () => void; title?: ReactNode; backLabel?: string; } const AppHeader: React.FC = ({ showBackButton = true, noBottomMargin = false, children, backTo = '..', onBack, title, backLabel = 'Back' }) => { const navigate = useNavigate(); return ( // Wraps rather than overlapping when Back and the actions do not fit on one line, as on a phone. {showBackButton && ( )} {title &&

{title}

}
{children && ( {children} )}
); }; export default AppHeader;