Skip to content

Commit

Permalink
style: Cart improved
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriassuncx committed Jun 3, 2024
1 parent f0399e2 commit d07f3a8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
47 changes: 29 additions & 18 deletions components/header/Buttons/Cart/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Icon from "$store/components/ui/Icon.tsx";
import { sendEvent } from "$store/sdk/analytics.tsx";
import { useUI } from "$store/sdk/useUI.ts";
import { AnalyticsItem } from "apps/commerce/types.ts";
import { formatPrice } from "deco-sites/maconequiio/sdk/format.ts";

interface Props {
loading: boolean;
Expand All @@ -24,25 +25,35 @@ function CartButton({ loading, currency, total, items }: Props) {
};

return (
<div class="indicator">
<span
class={`indicator-item badge badge-secondary badge-sm ${
totalItems === 0 ? "hidden" : ""
}`}
>
{totalItems > 9 ? "9+" : totalItems}
</span>
<Button
data-deco={displayCart.value && "open-cart"}
loading={loading}
aria-label="open cart"
onClick={onClick}
class="flex items-center justify-center gap-2.5 w-full max-w-40 h-14 text-white-normal bg-red hover:bg-red rounded-tl-2xl rounded-br-2xl px-4 shadow-lg"
>
<div class="indicator">
<span
class={`indicator-item badge border-none w-5 h-5 bg-black text-white-normal badge-sm -translate-x-[-13.75px] translate-y-[-6px] ${
totalItems === 0 ? "hidden" : ""
}`}
>
{totalItems > 9 ? "9+" : totalItems}
</span>

<Button
class="btn-circle btn-sm btn-ghost"
aria-label="open cart"
data-deco={displayCart.value && "open-cart"}
loading={loading}
onClick={onClick}
>
<Icon id="ShoppingCart" size={24} strokeWidth={2} />
</Button>
</div>
<Icon
id="CartIcon"
size={22}
strokeWidth={2}
class="text-white-normal"
/>
</div>

<div class="flex flex-col gap-0.5">
<span>Cesta</span>
<span class="font-bold text-sm">{formatPrice(total)}</span>
</div>
</Button>
);
}

Expand Down
1 change: 1 addition & 0 deletions components/ui/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type AvailableIcons =
| "FilterList"
| "Heart"
| "Guard"
| "CartIcon"
| "Check"
| "Instagram"
| "Linkedin"
Expand Down
2 changes: 2 additions & 0 deletions static/sprites.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d07f3a8

Please sign in to comment.