From 9d0e77fc984a16a92d6d3560e8fba71d0ae11a57 Mon Sep 17 00:00:00 2001 From: Bastian Masanek Date: Mon, 3 Nov 2025 11:41:32 +0100 Subject: [PATCH] Add cart button to desktop header with price display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented desktop cart button in navigation header that displays: - Shopping cart icon with item count badge (red, top-right) - Total cart price in German locale (EUR) - Click opens CartSidebar via useCartUI() composable - Responsive: visible only on lg breakpoint and above - Hidden on mobile (FAB is used instead) Uses useCart() composable for itemCount and total, with proper Intl.NumberFormat formatting for EUR display. Also standardized CartFAB price formatting to use Intl.NumberFormat for consistency with rest of codebase. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/components/Cart/CartFAB.vue | 75 +++++++++++++++++++++++ app/components/navigation/CartButton.vue | 77 +++++++++++++++--------- 2 files changed, 125 insertions(+), 27 deletions(-) create mode 100644 app/components/Cart/CartFAB.vue diff --git a/app/components/Cart/CartFAB.vue b/app/components/Cart/CartFAB.vue new file mode 100644 index 0000000..dcd5d48 --- /dev/null +++ b/app/components/Cart/CartFAB.vue @@ -0,0 +1,75 @@ + + + diff --git a/app/components/navigation/CartButton.vue b/app/components/navigation/CartButton.vue index 2fdd178..7ba3622 100644 --- a/app/components/navigation/CartButton.vue +++ b/app/components/navigation/CartButton.vue @@ -2,42 +2,65 @@ import { ShoppingCart } from 'lucide-vue-next' import { Badge } from '@/components/ui/badge' -// TODO: This will come from cart store/composable in Phase 5 -const cartItemCount = ref(0) +const { itemCount, total } = useCart() +const { open } = useCartUI() -const hasItems = computed(() => cartItemCount.value > 0) +const hasItems = computed(() => itemCount.value > 0) + +// Format total price in German locale (EUR) +const formattedTotal = computed(() => { + return new Intl.NumberFormat('de-DE', { + style: 'currency', + currency: 'EUR', + }).format(total.value) +}) + +// Handle button click to open cart sidebar +function handleClick(e: Event) { + e.preventDefault() + open() +}