diff --git a/components/cart/index.ts b/components/cart/index.ts index 0aff7cdfb..3e53fa34a 100644 --- a/components/cart/index.ts +++ b/components/cart/index.ts @@ -1 +1,2 @@ export { default as CartSidebarView } from './CartSidebarView' +export { default as CartItem } from './CartItem' diff --git a/components/core/I18nWidget/I18nWidget.module.css b/components/core/I18nWidget/I18nWidget.module.css index e9986cd32..afb5026f4 100644 --- a/components/core/I18nWidget/I18nWidget.module.css +++ b/components/core/I18nWidget/I18nWidget.module.css @@ -3,7 +3,7 @@ } .button { - @apply h-10 px-2 rounded-md border border-accents-2 flex items-center space-x-2 justify-center; + @apply h-10 px-2 rounded-md border border-accents-2 flex items-center space-x-2 justify-center outline-none focus:outline-none; } .dropdownMenu { diff --git a/components/core/Layout/Layout.tsx b/components/core/Layout/Layout.tsx index 6dd2ee101..a1d96eb2c 100644 --- a/components/core/Layout/Layout.tsx +++ b/components/core/Layout/Layout.tsx @@ -36,7 +36,6 @@ const Layout: FC = ({ children, pageProps }) => { } }, []) - console.log(displaySidebar, displayDropdown) usePreventScroll({ isDisabled: !displaySidebar, }) diff --git a/components/core/Searchbar/Searchbar.module.css b/components/core/Searchbar/Searchbar.module.css index 0d2265650..2c3ca27f7 100644 --- a/components/core/Searchbar/Searchbar.module.css +++ b/components/core/Searchbar/Searchbar.module.css @@ -3,10 +3,6 @@ min-width: 300px; } -.input:focus { - @apply outline-none shadow-outline-gray; -} - .iconContainer { @apply absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none; } diff --git a/components/core/UserNav/DropdownMenu.tsx b/components/core/UserNav/DropdownMenu.tsx index 0f45c7940..1f935657c 100644 --- a/components/core/UserNav/DropdownMenu.tsx +++ b/components/core/UserNav/DropdownMenu.tsx @@ -10,6 +10,21 @@ interface DropdownMenuProps { open: boolean } +const LINKS = [ + { + name: 'My Orders', + href: '/orders', + }, + { + name: 'My Profile', + href: '/profile', + }, + { + name: 'Cart', + href: '/cart', + }, +] + const DropdownMenu: FC = ({ open = false }) => { const { theme, setTheme } = useTheme() @@ -24,39 +39,36 @@ const DropdownMenu: FC = ({ open = false }) => { leaveTo="transform opacity-0 scale-95" > + {LINKS.map(({ name, href }) => ( + + + {({ active }) => ( + {name} + )} + + + ))} - {({ active }) => My Purchases} + + theme === 'dark' ? setTheme('light') : setTheme('dark') + } + > +
+ Theme: {theme}{' '} +
+
+ {theme == 'dark' ? ( + + ) : ( + + )} +
+
- {({ active }) => My Account} - - - {({ active }) => ( - - theme === 'dark' ? setTheme('light') : setTheme('dark') - } - > -
- Theme: {theme}{' '} -
-
- {theme == 'dark' ? ( - - ) : ( - - )} -
-
- )} -
- - {({ active }) => ( - - Logout - - )} + Logout
diff --git a/components/core/UserNav/UserNav.module.css b/components/core/UserNav/UserNav.module.css index a22a1868c..f96b44935 100644 --- a/components/core/UserNav/UserNav.module.css +++ b/components/core/UserNav/UserNav.module.css @@ -2,9 +2,6 @@ @apply relative; } -.mainContainer { -} - .list { @apply flex flex-row items-center justify-items-end h-full; } @@ -25,3 +22,11 @@ @apply outline-none; } } + +.bagCount { + @apply border border-accents-1 bg-secondary text-secondary h-4 w-4 absolute rounded-full right-3 top-3 flex items-center justify-center font-bold text-xs; +} + +.avatarButton { + @apply inline-flex justify-center rounded-full outline-none focus:outline-none; +} diff --git a/components/core/UserNav/UserNav.tsx b/components/core/UserNav/UserNav.tsx index c63ba2d9d..20b59e24a 100644 --- a/components/core/UserNav/UserNav.tsx +++ b/components/core/UserNav/UserNav.tsx @@ -1,9 +1,9 @@ import Link from 'next/link' import cn from 'classnames' import s from './UserNav.module.css' -import { FC, useRef } from 'react' -import { Avatar } from '@components/core' +import { FC } from 'react' import { Heart, Bag } from '@components/icon' +import { Avatar } from '@components/core' import { useUI } from '@components/ui/context' import DropdownMenu from './DropdownMenu' import { Menu } from '@headlessui/react' @@ -20,9 +20,7 @@ const countItems = (count: number, items: any[]) => const UserNav: FC = ({ className, children, ...props }) => { const { data } = useCart() const { openSidebar, closeSidebar, displaySidebar } = useUI() - const itemsCount = Object.values(data?.line_items ?? {}).reduce(countItems, 0) - let ref = useRef() as React.MutableRefObject return (