Files
2026-03-01 13:23:49 +00:00

70 lines
2.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { CountUp } from './CountUp.jsx';
import { ArrowPathIcon, HomeIcon } from '@heroicons/react/24/outline';
import { motion, useReducedMotion } from 'framer-motion';
import { useNavigate } from 'react-router-dom';
import logo from '../assets/logolang.png';
import { Button } from './Button.jsx';
export function Header({ count, title = 'Kenteken Generator', onRestart, onHome }) {
const navigate = useNavigate();
const reduceMotion = useReducedMotion();
return (
<motion.header
className="header"
initial={reduceMotion ? { opacity: 1 } : { y: -20, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ duration: reduceMotion ? 0 : 0.28 }}
>
<div className="header-inner">
<div
className="flex flex-col items-center cursor-pointer"
onClick={() => navigate('/generate')}
>
<motion.img
src={logo}
alt="CarKiddo"
className="h-10 w-auto"
whileHover={reduceMotion ? undefined : { rotate: 2, y: -1 }}
transition={{ type: 'spring', stiffness: 300, damping: 20 }}
/>
<motion.div
className="header-title mt-1"
initial={reduceMotion ? false : { opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3 }}
>
{title}
</motion.div>
</div>
<div className="flex items-center gap-3">
<div className="subtle flex items-center gap-1 text-sm">
🚗 <CountUp value={count} /> kinderautos
</div>
{onHome && (
<Button
type="button"
variant="ghost"
className="px-3 py-1.5 text-xs flex items-center gap-1"
onClick={onHome}
>
<HomeIcon className="w-4 h-4" />
Home
</Button>
)}
{onRestart && (
<Button
type="button"
variant="ghost"
className="px-3 py-1.5 text-xs flex items-center gap-1"
onClick={onRestart}
>
<ArrowPathIcon className="w-4 h-4" />
Opnieuw
</Button>
)}
</div>
</div>
</motion.header>
);
}