Deploy
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
'use client'
|
||||||
|
import { useMedusaProducts } from '@/hooks/useMedusaProducts'
|
||||||
|
import Link from 'next/link'
|
||||||
|
import { Card, CardContent, CardFooter } from '@/components/ui/Card'
|
||||||
|
import Badge from '@/components/ui/Badge'
|
||||||
|
import Button from '@/components/ui/Button'
|
||||||
|
import { Eye } from 'lucide-react'
|
||||||
|
|
||||||
|
const CURRENCY_SYMBOLS: Record<string, string> = { zar: 'R', usd: '$', eur: '€', gbp: '£', kes: 'KSh', ngn: '₦', ghs: '₵' }
|
||||||
|
const formatPrice = (amount: number, code?: string) => {
|
||||||
|
const sym = CURRENCY_SYMBOLS[(code ?? '').toLowerCase()] ?? (code?.toUpperCase() ?? '')
|
||||||
|
return `${sym}${(amount / 100).toFixed(2)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function NewArrivalsSection() {
|
||||||
|
const { products, isLoading } = useMedusaProducts(4)
|
||||||
|
if (isLoading) return <div className="flex justify-center py-16"><div className="w-8 h-8 rounded-full border-2 border-[#18181b] border-t-transparent animate-spin" /></div>
|
||||||
|
if (!products || products.length === 0) return null
|
||||||
|
return (
|
||||||
|
<section id="new-arrivals" data-vula-section="new-arrivals" className="py-16 bg-white border-t-[3px] border-[#18181b]">
|
||||||
|
<div className="container mx-auto px-4">
|
||||||
|
<h2 className="text-4xl font-black uppercase tracking-tight text-[#18181b] mb-2" style={{ fontFamily: 'Archivo Black, sans-serif', WebkitTextStroke: '0.5px currentColor' }}>Fresh Off the Block: New Threads</h2>
|
||||||
|
<p className="text-[#18181b]/70 uppercase tracking-widest text-sm mb-8">Limited edition drops — grab yours before they vanish</p>
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
|
{products.map((product) => {
|
||||||
|
const price = product.variants?.[0]?.prices?.[0]
|
||||||
|
return (
|
||||||
|
<Card key={product.id} className="group relative overflow-hidden border-[3px] border-[#18181b] shadow-[6px_6px_0_0_#18181b] bg-white transition-all duration-200 ease-out hover:shadow-[3px_3px_0_0_#dc2626] hover:-translate-x-[3px] hover:-translate-y-[3px]">
|
||||||
|
<div className="relative aspect-[4/3] overflow-hidden">
|
||||||
|
<img src={product.thumbnail ?? '/placeholder-product.svg'} alt={product.title} className="object-cover w-full h-full group-hover:scale-105 transition-transform duration-500 ease-out" />
|
||||||
|
<Badge variant="accent" className="absolute top-2 left-2 uppercase font-bold text-xs">Just Landed</Badge>
|
||||||
|
</div>
|
||||||
|
<CardContent className="p-4">
|
||||||
|
<h3 className="font-bold text-lg text-[#18181b] uppercase">{product.title}</h3>
|
||||||
|
{price && (
|
||||||
|
<p className="text-[#dc2626] font-black text-xl mt-1">{formatPrice(price.amount, price.currency_code)}</p>
|
||||||
|
)}
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter className="px-4 pb-4 pt-0 flex gap-2">
|
||||||
|
<Link href={`/products/${product.id}`}>
|
||||||
|
<Button variant="ghost" size="sm" className="text-[#18181b] hover:text-[#dc2626] flex items-center gap-1">
|
||||||
|
<Eye className="w-4 h-4" /> Quick View
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
<Link href={`/products/${product.id}`}>
|
||||||
|
<Button variant="default" size="sm" className="bg-[#18181b] text-white uppercase">Shop Now</Button>
|
||||||
|
</Link>
|
||||||
|
</CardFooter>
|
||||||
|
</Card>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user