import { Search, Menu, Wifi, WifiOff, Star, ArrowLeft } from 'lucide-react'; import { useState, useEffect } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { Button } from '@/components/ui/button'; interface HeaderProps { onSearchClick: () => void; onMenuClick: () => void; } const Header = ({ onSearchClick, onMenuClick }: HeaderProps) => { const navigate = useNavigate(); const location = useLocation(); // Mostrar botón de retroceso si no estamos en la página principal const showBackButton = location.pathname !== '/'; const [isOnline, setIsOnline] = useState(navigator.onLine); useEffect(() => { const handleOnline = () => setIsOnline(true); const handleOffline = () => setIsOnline(false); window.addEventListener('online', handleOnline); window.addEventListener('offline', handleOffline); return () => { window.removeEventListener('online', handleOnline); window.removeEventListener('offline', handleOffline); }; }, []); const handleBack = () => { if (window.history.length > 1) { navigate(-1); } else { navigate('/'); } }; return (
{showBackButton && ( )}
TES

EMERGES TES

Guía de Protocolos

{isOnline ? ( <> Online ) : ( <> Offline )}
); }; export default Header;