2025-02-21 14:48:21 -05:00
|
|
|
import { Link, useNavigate } from 'react-router-dom';
|
2024-03-29 20:08:34 -04:00
|
|
|
import * as React from 'react';
|
|
|
|
|
import { Button } from '@mui/material';
|
2025-04-04 16:24:46 -04:00
|
|
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
|
|
|
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
|
2024-03-29 20:08:34 -04:00
|
|
|
|
|
|
|
|
interface HeaderProps {
|
2025-02-21 14:48:21 -05:00
|
|
|
isLoggedIn: boolean;
|
2024-03-29 20:08:34 -04:00
|
|
|
handleLogout: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Header: React.FC<HeaderProps> = ({ isLoggedIn, handleLogout }) => {
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
|
|
|
|
return (
|
2025-04-04 16:24:46 -04:00
|
|
|
<header className="d-flex justify-content-between align-items-center p-3 bg-white shadow-sm">
|
2024-03-29 20:08:34 -04:00
|
|
|
<img
|
|
|
|
|
src="/logo.png"
|
|
|
|
|
alt="Logo"
|
2025-04-04 16:24:46 -04:00
|
|
|
className="cursor-pointer"
|
2024-03-29 20:08:34 -04:00
|
|
|
onClick={() => navigate('/')}
|
|
|
|
|
/>
|
|
|
|
|
|
2025-04-04 16:24:46 -04:00
|
|
|
<div>
|
|
|
|
|
{isLoggedIn ? (
|
|
|
|
|
<Button
|
|
|
|
|
variant="outlined"
|
|
|
|
|
color="primary"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
handleLogout();
|
|
|
|
|
navigate('/');
|
|
|
|
|
}}
|
|
|
|
|
className="ms-2"
|
|
|
|
|
startIcon={<ExitToAppIcon />}
|
|
|
|
|
>
|
|
|
|
|
Logout
|
|
|
|
|
</Button>
|
|
|
|
|
) : (
|
|
|
|
|
<Link to="/login" className="text-decoration-none">
|
|
|
|
|
<button className="btn btn-outline-primary ms-2">
|
|
|
|
|
Connexion
|
|
|
|
|
</button>
|
2025-02-21 14:48:21 -05:00
|
|
|
</Link>
|
2025-04-04 16:24:46 -04:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
2024-03-29 20:08:34 -04:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2025-04-04 16:24:46 -04:00
|
|
|
export default Header;
|