import { useRouter } from 'next/router' import Link from '../Link/Link' import { HomeIcon, Bars3Icon, ShoppingCartIcon, ChevronLeftIcon } from '@heroicons/react/24/outline' import { useEffect, useState } from 'react' import { getCart } from '@/core/utils/cart' /** * The AppBar component is a navigation component used to display a header or toolbar * in a web application. * * @param {Object} props - Props received by the component. * @param {string} props.title - The title to be displayed on the AppBar. * @returns {JSX.Element} - Rendered AppBar component. */ const AppBar = ({ title }) => { const router = useRouter() const [cartCount, setCartCount] = useState(0) useEffect(() => { const handleCartChange = () => { setCartCount(Object.keys(getCart()).length) } handleCartChange() window.addEventListener('localStorageChange', handleCartChange) return () => { window.removeEventListener('localStorageChange', handleCartChange) } }, []) return ( ) } export default AppBar