Skip to content

Commit

Permalink
Merge pull request #8 from jobsofferings/main
Browse files Browse the repository at this point in the history
Hide the badge when there is no content in the shopping cart
  • Loading branch information
huanghanzhilian authored May 13, 2024
2 parents 8dd49e6 + f728c97 commit 0b2b221
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/cart/CartBadge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export default function CartBadge() {
//? Render(s)
return (
<div className="relative">
<span className="absolute outline outline-2 bottom-3.5 left-5 bg-red-500 rounded-md w-5 h-5 p-0.5 text-center text-xs text-white">
{formatNumber(totalItems)}
</span>
{totalItems ? (
<span className="absolute outline outline-2 bottom-3.5 left-5 bg-red-500 rounded-md w-5 h-5 p-0.5 text-center text-xs text-white">
{formatNumber(totalItems)}
</span>
) : null}

<Icons.Cart className="icon h-7 w-7" />
</div>
Expand Down

0 comments on commit 0b2b221

Please sign in to comment.