diff --git a/src/components/sections/MenuHighlightsSection.tsx b/src/components/sections/MenuHighlightsSection.tsx new file mode 100644 index 0000000..06a6665 --- /dev/null +++ b/src/components/sections/MenuHighlightsSection.tsx @@ -0,0 +1,59 @@ +'use client' +import { useProducts } from '@/hooks/useProducts' +import Link from 'next/link' +import { Utensils } from 'lucide-react' +import { useVulaCart } from '@/hooks/useVulaCart' + +const CURRENCY_SYMBOLS: Record = { zar: 'R', usd: '$', eur: '€', gbp: '£', kes: 'KSh', ngn: '₦', ghs: '₵' } +const fmt = (amount: number, code?: string) => { + const sym = CURRENCY_SYMBOLS[(code ?? '').toLowerCase()] ?? (code?.toUpperCase() ?? '') + return `${sym}${(amount / 100).toFixed(2)}` +} + +export default function MenuHighlightsSection() { + const { products: dishes, isLoading } = useProducts(8) + const { addToCart } = useVulaCart() + if (isLoading) return ( +
{Array.from({ length: 8 }).map((_, i) =>
)}
+ ) + if (!dishes.length) return null + return ( +
+
+
+
+

On The Menu

+

Menu Highlights

+
+ Full Menu → +
+
+ {dishes.slice(0, 8).map((dish) => { + const variant = dish.variants?.[0] + const price = variant?.prices?.[0] + return ( +
+ +
+ {dish.thumbnail + ? {dish.title + :
} +
+ +
+

{dish.title}

+ {price &&

{fmt(price.amount, price.currency_code)}

} + +
+
+ ) + })} +
+
+
+ ) +}