Header style improvements

This commit is contained in:
paco
2020-10-08 14:46:33 -06:00
parent 450921bd55
commit d8ff9bc4ff
5 changed files with 14 additions and 10 deletions

View File

@@ -6,7 +6,11 @@
}
.item {
@apply mr-6 cursor-pointer relative;
@apply mr-6 cursor-pointer relative transition ease-in-out duration-100;
&:hover {
@apply text-gray-500;
}
&:last-child {
@apply mr-0;

View File

@@ -16,17 +16,20 @@ const countItems = (count: number, items: any[]) =>
items.reduce(countItem, count)
const UserNav: FC<Props> = ({ className }) => {
const { openSidebar } = useUI()
const { openSidebar, closeSidebar, displaySidebar } = useUI()
const { data } = useCart()
const itemsCount = Object.values(data?.line_items ?? {}).reduce(countItems, 0)
return (
<nav className={cn(s.root, className)}>
<ul className={s.list}>
<li className={s.item} onClick={() => openSidebar()}>
<li
className={s.item}
onClick={() => (displaySidebar ? closeSidebar() : openSidebar())}
>
<Bag />
{itemsCount > 0 && (
<span className="bg-black h-4 w-4 absolute rounded-full inset-3 text-white flex items-center justify-center font-bold text-xs">
<span className="bg-black h-4 w-4 absolute rounded-full right-3 top-3 text-white flex items-center justify-center font-bold text-xs">
{itemsCount}
</span>
)}