import { FC, useState } from 'react' import cn from 'classnames' import useCart from '@lib/bigcommerce/cart/use-cart' import { Avatar } from '@components/core' import { Heart, Bag } from '@components/icon' import { useUI } from '@components/ui/context' import s from './UserNav.module.css' import Link from 'next/link' import { Logo } from '@components/ui' import { Toggle } from '@components/core' import { useTheme } from 'next-themes' interface Props { className?: string } const countItem = (count: number, item: any) => count + item.quantity const countItems = (count: number, items: any[]) => items.reduce(countItem, count) const UserNav: FC = ({ className }) => { const { data } = useCart() const [displayDropdown, setDisplayDropdown] = useState(true) const { openSidebar, closeSidebar, displaySidebar } = useUI() const itemsCount = Object.values(data?.line_items ?? {}).reduce(countItems, 0) const { theme, setTheme } = useTheme() return ( ) } export default UserNav