'use client';
import {
HeartIcon,
MinusIcon,
PlusIcon,
RotateCcwIcon,
StarIcon,
TruckIcon,
} from 'lucide-react';
import { useState } from 'react';
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from '@/components/ui/accordion';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
const images = [
{
src: 'https://images.unsplash.com/photo-1523381210434-271e8be1f52b?auto=format&fit=crop&w=1200&q=80',
alt: 'Fjell Wool Overshirt folded on a neutral background',
},
{
src: 'https://images.unsplash.com/photo-1539533018447-63fcce2678e3?auto=format&fit=crop&w=1200&q=80',
alt: 'Model wearing the overshirt outdoors',
},
{
src: 'https://images.unsplash.com/photo-1556905055-8f358a7a47b2?auto=format&fit=crop&w=1200&q=80',
alt: 'Flat lay of the overshirt with knit accessories',
},
{
src: 'https://images.unsplash.com/photo-1434389677669-e08b4cac3105?auto=format&fit=crop&w=1200&q=80',
alt: 'Styled with the Stilla Knit Sweater',
},
];
const colours = [
{ name: 'Oat', hex: '#D9CDB8' },
{ name: 'Charcoal', hex: '#3B3B3B' },
{ name: 'Moss', hex: '#5E6B4F' },
];
const sizes = [
{ label: 'XS', soldOut: false },
{ label: 'S', soldOut: false },
{ label: 'M', soldOut: false },
{ label: 'L', soldOut: true },
{ label: 'XL', soldOut: false },
];
/**
* Classic two-column product page: a large image with four thumbnails on the left; title, price, rating, colour swatches, size pills, quantity stepper, Add to cart / Buy now and a details Accordion on the right.
*/
export default function ProductDetails01() {
const [active, setActive] = useState(0);
const [colour, setColour] = useState('Oat');
const [size, setSize] = useState('M');
const [qty, setQty] = useState(1);
return (
<section className="w-full py-8 sm:py-12">
<div className="mx-auto w-full max-w-6xl px-6">
<nav aria-label="Breadcrumb" className="mb-6 text-muted-foreground text-sm">
<ol className="flex items-center gap-2">
<li>
<a className="hover:text-foreground" href="#">
Men
</a>
</li>
<li aria-hidden="true">/</li>
<li>
<a className="hover:text-foreground" href="#">
Shirts
</a>
</li>
<li aria-hidden="true">/</li>
<li className="text-foreground">Fjell Wool Overshirt</li>
</ol>
</nav>
<div className="grid gap-10 md:grid-cols-2 md:gap-12">
<div className="flex flex-col gap-3">
<div className="relative overflow-hidden rounded-xl bg-muted">
<img
alt={images[active].alt}
className="aspect-[4/5] w-full object-cover"
loading="lazy"
src={images[active].src}
/>
<Badge className="absolute top-3 left-3" variant="secondary">
New
</Badge>
</div>
<div className="grid grid-cols-4 gap-3">
{images.map((image, index) => (
<button
aria-label={`Show image ${index + 1}`}
aria-pressed={active === index}
className={cn(
'overflow-hidden rounded-lg border-2 transition-colors',
active === index
? 'border-primary'
: 'border-transparent hover:border-border'
)}
key={image.src}
onClick={() => setActive(index)}
type="button"
>
<img
alt=""
className="aspect-square w-full object-cover"
loading="lazy"
src={image.src.replace('w=1200', 'w=400')}
/>
</button>
))}
</div>
</div>
<form
className="flex flex-col"
onSubmit={(e) => e.preventDefault()}
>
<div className="flex items-start justify-between gap-4">
<div>
<p className="font-medium text-primary text-sm">Norra Men</p>
<h1 className="mt-1 font-semibold text-3xl text-foreground tracking-tight">
Fjell Wool Overshirt
</h1>
</div>
<Button
aria-label="Save to wishlist"
size="icon"
type="button"
variant="outline"
>
<HeartIcon aria-hidden="true" />
</Button>
</div>
<div className="mt-4 flex flex-wrap items-center gap-4">
<p className="font-semibold text-2xl text-foreground tabular-nums">
€129.00
</p>
<a className="flex items-center gap-2 text-sm" href="#reviews">
<span className="flex items-center text-primary">
{Array.from({ length: 5 }).map((_, i) => (
<StarIcon
aria-hidden="true"
className={cn(
'size-4',
i < 4 ? 'fill-current' : 'fill-current opacity-30'
)}
key={i}
/>
))}
</span>
<span className="text-muted-foreground">4.8 · 126 reviews</span>
</a>
</div>
<p className="mt-4 text-muted-foreground text-sm leading-6">
A heavyweight overshirt woven from recycled Norwegian wool. Cut
to layer over a tee in autumn or a sweater in deep winter, with
two chest pockets and corozo buttons.
</p>
<fieldset className="mt-6">
<legend className="flex w-full items-center justify-between font-medium text-foreground text-sm">
Colour
<span className="font-normal text-muted-foreground">{colour}</span>
</legend>
<div className="mt-3 flex gap-3">
{colours.map((item) => (
<button
aria-label={item.name}
aria-pressed={colour === item.name}
className={cn(
'flex size-9 items-center justify-center rounded-full border-2 transition-colors',
colour === item.name
? 'border-primary'
: 'border-transparent hover:border-border'
)}
key={item.name}
onClick={() => setColour(item.name)}
type="button"
>
<span
className="size-7 rounded-full border border-border"
style={{ backgroundColor: item.hex }}
/>
</button>
))}
</div>
</fieldset>
<fieldset className="mt-6">
<legend className="flex w-full items-center justify-between font-medium text-foreground text-sm">
Size
<a className="font-normal text-muted-foreground underline underline-offset-4" href="#">
Size guide
</a>
</legend>
<div className="mt-3 flex flex-wrap gap-2">
{sizes.map((item) => (
<button
aria-pressed={size === item.label}
className={cn(
'min-w-12 rounded-md border px-3 py-2 font-medium text-sm transition-colors',
item.soldOut &&
'cursor-not-allowed text-muted-foreground line-through opacity-60',
!item.soldOut && size === item.label
? 'border-primary bg-primary text-primary-foreground'
: 'border-input bg-background text-foreground hover:bg-muted'
)}
disabled={item.soldOut}
key={item.label}
onClick={() => setSize(item.label)}
title={item.soldOut ? 'Sold out' : undefined}
type="button"
>
{item.label}
</button>
))}
</div>
<p className="mt-2 text-muted-foreground text-xs">
Size L is sold out –{' '}
<a className="underline underline-offset-4" href="#">
notify me when it is back
</a>
.
</p>
</fieldset>
<div className="mt-6 flex flex-col gap-3 sm:flex-row">
<div className="inline-flex h-10 w-fit items-center rounded-md border border-input">
<Button
aria-label="Decrease quantity"
className="size-10 rounded-r-none"
isDisabled={qty <= 1}
onPress={() => setQty((q) => Math.max(1, q - 1))}
size="icon"
type="button"
variant="ghost"
>
<MinusIcon aria-hidden="true" />
</Button>
<span className="w-10 text-center font-medium text-sm tabular-nums">
{qty}
</span>
<Button
aria-label="Increase quantity"
className="size-10 rounded-l-none"
onPress={() => setQty((q) => q + 1)}
size="icon"
type="button"
variant="ghost"
>
<PlusIcon aria-hidden="true" />
</Button>
</div>
<Button className="h-10 flex-1" type="submit">
Add to cart
</Button>
<Button className="h-10 flex-1" type="button" variant="outline">
Buy now
</Button>
</div>
<ul className="mt-6 flex flex-col gap-2 text-sm">
<li className="flex items-center gap-3 text-muted-foreground">
<TruckIcon aria-hidden="true" className="size-4 shrink-0" />
Free carbon-neutral shipping on orders over €75 · 2–4 business
days
</li>
<li className="flex items-center gap-3 text-muted-foreground">
<RotateCcwIcon aria-hidden="true" className="size-4 shrink-0" />
30-day free returns, no questions asked
</li>
</ul>
<Accordion className="mt-6 border-t" defaultExpandedKeys={['details']}>
<AccordionItem id="details">
<AccordionTrigger>Details</AccordionTrigger>
<AccordionContent className="text-muted-foreground leading-6">
Relaxed fit with dropped shoulders. Two buttoned chest
pockets, side vents and a straight hem that sits at the hip.
The model is 186 cm and wears size M.
</AccordionContent>
</AccordionItem>
<AccordionItem id="materials">
<AccordionTrigger>Materials & care</AccordionTrigger>
<AccordionContent className="text-muted-foreground leading-6">
80% recycled wool, 20% recycled polyamide. Woven in Portugal.
Spot clean or hand wash cold, lay flat to dry. Do not tumble
dry.
</AccordionContent>
</AccordionItem>
<AccordionItem id="shipping">
<AccordionTrigger>Shipping</AccordionTrigger>
<AccordionContent className="text-muted-foreground leading-6">
Standard EU delivery €4.90, free over €75. Express next-day
€9.90 when ordered before 14:00 CET. Gift wrapping available
for €3.50.
</AccordionContent>
</AccordionItem>
</Accordion>
</form>
</div>
</div>
</section>
);
}