Complete configurator overhaul with premium design

Major Changes:
- Replaced static preview with dynamic SVG door visualizer
- Integrated Zustand for real-time state management
- Redesigned UI with Dark Green (#1A2E2E) and Pistachio (#C4D668) colors
- Removed all orange branding (brand-orange)
- Premium selection tiles with active/inactive states
- Live door rendering that updates instantly on selection

Features:
- Dynamic SVG draws door based on configuration
- Real-time updates: doorType, gridType, finish, handle
- Background room image with semi-transparent overlay
- Animated "Live Voorbeeld" badge with pulse effect
- Configuration info card showing current selections
- Premium typography with Inter font

Technical:
- Added Zustand state management (lib/store.ts)
- Created DoorVisualizer component with SVG logic
- Updated step-product and step-options with premium tiles
- Color swatches for finish selection
- Check icons for selected states

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Ubuntu
2026-02-10 16:14:28 +00:00
parent 9cf5cea3ba
commit 9fc1344177
7 changed files with 559 additions and 144 deletions

View File

@@ -1,79 +1,157 @@
"use client";
import Image from "next/image";
import { useConfiguratorStore, type DoorType } from "@/lib/store";
import { useFormContext } from "@/components/offerte/form-context";
import { productTypes } from "@/lib/validators";
import { cn } from "@/lib/utils";
import { Check } from "lucide-react";
const productImages: Record<string, string> = {
Taatsdeur: "/images/taats.jpg",
Scharnierdeur: "/images/scharnier.jpg",
"Vast Paneel": "/images/paneel.jpg",
};
const doorTypes: Array<{
value: DoorType;
label: string;
description: string;
}> = [
{
value: "taats",
label: "Taatsdeur",
description: "Pivoterende deur met verticaal draaimechanisme",
},
{
value: "scharnier",
label: "Scharnierdeur",
description: "Klassieke deur met zijscharnieren",
},
{
value: "paneel",
label: "Vast Paneel",
description: "Vast glaspaneel zonder bewegend mechanisme",
},
];
const productDescriptions: Record<string, string> = {
Taatsdeur: "Pivoterende deur",
Scharnierdeur: "Klassiek scharnier",
"Vast Paneel": "Vast glaspaneel",
};
const gridTypes: Array<{
value: "3-vlak" | "4-vlak" | "geen";
label: string;
description: string;
}> = [
{ value: "geen", label: "Geen verdeling", description: "Volledig vlak" },
{ value: "3-vlak", label: "3-vlaks", description: "2 horizontale balken" },
{ value: "4-vlak", label: "4-vlaks", description: "3 horizontale balken" },
];
export function StepProduct() {
const { formData, updateData, nextStep } = useFormContext();
const { nextStep } = useFormContext();
const { doorType, gridType, setDoorType, setGridType } =
useConfiguratorStore();
function select(type: (typeof productTypes)[number]) {
updateData({ productType: type });
function handleDoorTypeSelect(type: DoorType) {
setDoorType(type);
}
function handleGridTypeSelect(type: "3-vlak" | "4-vlak" | "geen") {
setGridType(type);
}
function handleContinue() {
nextStep();
}
return (
<div>
<h2 className="mb-2 text-xl font-semibold">Kies uw product</h2>
<p className="mb-6 text-sm text-muted-foreground">
Selecteer het type stalen element dat u wilt configureren.
</p>
<div className="space-y-8">
{/* Door Type Selection */}
<div>
<h2 className="mb-2 text-lg font-bold text-[#1A2E2E]">Kies uw deurtype</h2>
<p className="mb-4 text-sm text-gray-600">
Selecteer het type stalen deur dat u wilt configureren.
</p>
<div className="grid gap-4 sm:grid-cols-3">
{productTypes.map((type) => {
const selected = formData.productType === type;
<div className="grid gap-3">
{doorTypes.map((type) => {
const selected = doorType === type.value;
return (
<button
key={type}
type="button"
onClick={() => select(type)}
className={cn(
"group relative aspect-[3/4] overflow-hidden text-left transition-all",
selected
? "ring-4 ring-brand-orange ring-offset-2"
: "ring-0 hover:ring-2 hover:ring-brand-orange/40 hover:ring-offset-1"
)}
>
{/* Image fills entire card */}
<Image
src={productImages[type]}
alt={type}
fill
className="object-cover transition-transform duration-500 group-hover:scale-105"
/>
{/* Bottom gradient with label */}
<div className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent px-4 pb-5 pt-16">
<p className="text-xs font-medium uppercase tracking-wider text-white/60">
{productDescriptions[type]}
</p>
<h3 className="mt-1 text-lg font-semibold text-white">
{type}
</h3>
</div>
{/* Selected state overlay */}
{selected && (
<div className="absolute inset-0 border-4 border-brand-orange" />
)}
</button>
);
})}
return (
<button
key={type.value}
type="button"
onClick={() => handleDoorTypeSelect(type.value)}
className={`group relative rounded-xl border-2 p-4 text-left transition-all ${
selected
? "border-[#C4D668] bg-[#1A2E2E] text-white"
: "border-gray-200 bg-white text-gray-900 hover:border-[#1A2E2E]/30"
}`}
>
<div className="flex items-start justify-between">
<div className="flex-1">
<h3 className="font-bold">{type.label}</h3>
<p
className={`mt-1 text-sm ${
selected ? "text-white/80" : "text-gray-500"
}`}
>
{type.description}
</p>
</div>
{selected && (
<div className="flex size-6 items-center justify-center rounded-full bg-[#C4D668]">
<Check className="size-4 text-[#1A2E2E]" />
</div>
)}
</div>
</button>
);
})}
</div>
</div>
{/* Grid Type Selection */}
<div>
<h2 className="mb-2 text-lg font-bold text-[#1A2E2E]">Verdeling</h2>
<p className="mb-4 text-sm text-gray-600">
Kies het aantal horizontale vlakken.
</p>
<div className="grid gap-3">
{gridTypes.map((type) => {
const selected = gridType === type.value;
return (
<button
key={type.value}
type="button"
onClick={() => handleGridTypeSelect(type.value)}
className={`group relative rounded-xl border-2 p-4 text-left transition-all ${
selected
? "border-[#C4D668] bg-[#1A2E2E] text-white"
: "border-gray-200 bg-white text-gray-900 hover:border-[#1A2E2E]/30"
}`}
>
<div className="flex items-start justify-between">
<div className="flex-1">
<h3 className="font-bold">{type.label}</h3>
<p
className={`mt-1 text-sm ${
selected ? "text-white/80" : "text-gray-500"
}`}
>
{type.description}
</p>
</div>
{selected && (
<div className="flex size-6 items-center justify-center rounded-full bg-[#C4D668]">
<Check className="size-4 text-[#1A2E2E]" />
</div>
)}
</div>
</button>
);
})}
</div>
</div>
{/* Continue Button */}
<button
onClick={handleContinue}
className="w-full rounded-xl bg-[#C4D668] py-3 font-bold text-[#1A2E2E] transition-all hover:bg-[#b5c75a]"
>
Volgende stap
</button>
</div>
);
}