import React from 'react'; import FontSizeToggleTab from '../font-size-tabs'; import AppearanceToggleTab from '../appearance-tabs'; import { cn } from '@/lib/utils'; import { useEffect, useState } from 'react'; import { SearchInput } from '@/components/search-input/search-input'; import { Phone } from 'lucide-react'; import { Link } from '@inertiajs/react'; interface HeaderData { title1?: string; title2?: string; subtitle?: string; logo?: string; telephone: string; links: Array<{ name: string; icon?: string; 'icon-alt'?: string; url: string; external: boolean; }>; } interface HeaderProps extends React.HTMLAttributes {} export default function Header({ className, ...props }: HeaderProps) { const [headerData, setHeaderData] = useState(null); useEffect(() => { fetch('/api/header') .then(response => response.json()) .then(data => setHeaderData(data)) .catch(error => console.error('Error fetching header data:', error)); }, []); const linksMap = headerData?.links && headerData.links.length > 0 ? headerData.links.map((link, index) => link.external ? ( {link.icon && ( {link['icon-alt'] )} ) : ( {link.icon && ( {link['icon-alt'] )} )) : null; return (
{linksMap}
Logo szpitala
{headerData?.title1}{headerData?.title2}
{headerData?.subtitle}
); }