Space Visualizer

import { useState, useRef, useEffect } from "react"; const FONTS = `@import url('https://fonts.googleapis.com/css2?family=Cormorant:ital,wght@0,300;0,400;1,300;1,400&family=Syne:wght@400;500;600&display=swap');`; const STONES = [ { id: "taj-mahal", name: "Taj Mahal", url: "https://asetica.com.au/cdn/shop/files/taj-mahal-sintered-stone-perth.jpg?v=1723100936" }, { id: "travertino-pearl", name: "Travertino Pearl", url: "https://asetica.com.au/cdn/shop/files/Travertine_inspired_sintered_stone_design_sydney_and_perth.jpg?v=1754523994" }, { id: "calacatta-white", name: "Calacatta White", url: "https://asetica.com.au/cdn/shop/files/calacatta_white_sintered_stone_asetica_surfaces.jpg?v=1754631680" }, { id: "wild-ferrara", name: "Wild Ferrara", url: "https://asetica.com.au/cdn/shop/files/Wild_Ferrara_65df51da-4f43-4570-903b-65328dbbbf6a.jpg?v=1762476984" }, { id: "taj-mahal-royal", name: "Taj Mahal Royal", url: "https://asetica.com.au/cdn/shop/files/Taj_Mahal_Royale_81112269-22f6-4656-b01c-a53f9058d1ab.jpg?v=1762476984" }, { id: "loro-white", name: "Loro White", url: "https://asetica.com.au/cdn/shop/files/Loro_White_7dd19602-8154-4c5e-b41d-161115f0d22e.jpg?v=1762390913" }, { id: "crema-travertine", name: "Crema Travertine", url: "https://asetica.com.au/cdn/shop/files/Crema_Travetine_eb01c89f-5284-437c-824d-bbb3973f5621.jpg?v=1762394146" }, { id: "essential-gold", name: "Essential Gold", url: "https://asetica.com.au/cdn/shop/files/Sintered_stone_bar_top_caringbah_bowls_club.jpg?v=1758156724" }, { id: "supergrey", name: "Supergrey", url: "https://asetica.com.au/cdn/shop/files/13.png?v=1758156724" }, { id: "st-laurent", name: "St Laurent", url: "https://asetica.com.au/cdn/shop/files/15.png?v=1758156724" }, { id: "pure-black", name: "Pure Black", url: "https://asetica.com.au/cdn/shop/files/7.png?v=1758156724" }, { id: "fior-di-bosco", name: "Fior di Bosco", url: "https://asetica.com.au/cdn/shop/files/18.png?v=1758156724" }, ]; const ROOMS = [ { id: "kitchen", label: "Kitchen", icon: "◻", image: "https://images.unsplash.com/photo-1556909172-54557c7e4fb7?w=1400&q=85&fit=crop&crop=center", surfaceLabel: "Benchtop", surfaces: [ { clipPath: "polygon(0% 58%, 100% 52%, 100% 68%, 0% 74%)", opacity: 0.82, label: "Island bench" }, ], }, { id: "bathroom", label: "Bathroom", icon: "◻", image: "https://images.unsplash.com/photo-1552321554-5fefe8c9ef14?w=1400&q=85&fit=crop&crop=center", surfaceLabel: "Vanity", surfaces: [ { clipPath: "polygon(8% 52%, 92% 52%, 92% 62%, 8% 62%)", opacity: 0.78, label: "Vanity top" }, ], }, { id: "facade", label: "Facade", icon: "◻", image: "https://images.unsplash.com/photo-1600585154340-be6161a56a0c?w=1400&q=85&fit=crop&crop=center", surfaceLabel: "Cladding", surfaces: [ { clipPath: "polygon(2% 5%, 60% 5%, 60% 95%, 2% 95%)", opacity: 0.75, label: "Wall cladding" }, ], }, { id: "outdoor", label: "Outdoor", icon: "◻", image: "https://images.unsplash.com/photo-1600210492486-724fe5c67fb0?w=1400&q=85&fit=crop&crop=center", surfaceLabel: "Pavers", surfaces: [ { clipPath: "polygon(0% 65%, 100% 55%, 100% 100%, 0% 100%)", opacity: 0.80, label: "Outdoor pavers" }, ], }, ]; const css = ` ${FONTS} * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Syne', sans-serif; background: #faf9f7; color: #1a1714; } .app { min-height: 100vh; display: flex; flex-direction: column; background: #faf9f7; } /* Header */ .header { padding: 20px 40px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(139,111,78,0.12); background: #fff; } .header-brand { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #1a1714; } .header-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a837a; } .header-badge { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; background: #f5f2ee; color: #8b6f4e; padding: 5px 12px; border: 1px solid rgba(139,111,78,0.2); } /* Main layout */ .main { flex: 1; display: grid; grid-template-columns: 1fr 380px; height: calc(100vh - 61px); } /* Visualizer */ .visualizer { position: relative; overflow: hidden; background: #1a1714; } .room-img { width: 100%; height: 100%; object-fit: cover; display: block; } .surface-overlay { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.5s ease; } .surface-texture { position: absolute; inset: 0; background-size: cover; background-position: center; mix-blend-mode: multiply; transition: background-image 0.4s ease, opacity 0.4s ease; } /* Room label */ .surface-hint { position: absolute; bottom: 24px; left: 24px; background: rgba(250,249,247,0.92); backdrop-filter: blur(8px); padding: 10px 18px; border: 1px solid rgba(139,111,78,0.15); display: flex; align-items: center; gap: 10px; } .surface-hint-dot { width: 8px; height: 8px; background: #8b6f4e; border-radius: 50%; } .surface-hint-text { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #4a4540; } .surface-hint-name { font-family: 'Cormorant', serif; font-size: 16px; color: #1a1714; font-style: italic; } /* Transition flash */ .flash-overlay { position: absolute; inset: 0; background: rgba(250,249,247,0.3); pointer-events: none; opacity: 0; transition: opacity 0.15s; } .flash-overlay.active { opacity: 1; } /* Sidebar */ .sidebar { background: #fff; border-left: 1px solid rgba(139,111,78,0.12); display: flex; flex-direction: column; overflow: hidden; } /* Room tabs */ .room-tabs { display: flex; border-bottom: 1px solid rgba(139,111,78,0.12); flex-shrink: 0; } .room-tab { flex: 1; padding: 16px 8px; text-align: center; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #8a837a; cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; transition: all 0.2s; font-family: 'Syne', sans-serif; } .room-tab:hover { color: #1a1714; background: #faf9f7; } .room-tab.active { color: #8b6f4e; border-bottom-color: #8b6f4e; background: #fff; } /* Stone section */ .stone-section { flex: 1; overflow-y: auto; padding: 20px; } .stone-section-header { margin-bottom: 16px; } .stone-section-title { font-family: 'Cormorant', serif; font-size: 22px; font-weight: 300; color: #1a1714; line-height: 1.2; } .stone-section-sub { font-size: 11px; letter-spacing: 0.08em; color: #8a837a; margin-top: 4px; } /* Stone grid */ .stone-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .stone-card { cursor: pointer; border: 1.5px solid transparent; transition: all 0.2s; background: #f5f2ee; position: relative; overflow: hidden; } .stone-card:hover { border-color: rgba(139,111,78,0.4); transform: translateY(-1px); } .stone-card.selected { border-color: #8b6f4e; } .stone-card.selected::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; background: #8b6f4e; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; display: grid; place-items: center; } .stone-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; } .stone-name { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: #4a4540; padding: 5px 6px; line-height: 1.3; background: #fff; } /* Footer action */ .sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(139,111,78,0.12); flex-shrink: 0; } .selected-stone-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; } .selected-thumb { width: 40px; height: 40px; object-fit: cover; border: 1px solid rgba(139,111,78,0.2); flex-shrink: 0; } .selected-info { flex: 1; } .selected-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: #8a837a; } .selected-name { font-family: 'Cormorant', serif; font-size: 17px; color: #1a1714; font-style: italic; margin-top: 1px; } .btn-request { display: block; width: 100%; padding: 14px; background: #8b6f4e; color: #fff; border: none; cursor: pointer; font-family: 'Syne', sans-serif; font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; transition: background 0.2s; } .btn-request:hover { background: #1a1714; } .btn-view { display: block; width: 100%; padding: 12px; background: none; color: #4a4540; border: 1px solid rgba(139,111,78,0.2); cursor: pointer; font-family: 'Syne', sans-serif; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; transition: all 0.2s; margin-top: 8px; } .btn-view:hover { border-color: #8b6f4e; color: #8b6f4e; } /* Scrollbar */ .stone-section::-webkit-scrollbar { width: 4px; } .stone-section::-webkit-scrollbar-track { background: #faf9f7; } .stone-section::-webkit-scrollbar-thumb { background: rgba(139,111,78,0.2); border-radius: 2px; } /* Responsive */ @media (max-width: 900px) { .main { grid-template-columns: 1fr; grid-template-rows: 55vh 1fr; height: auto; } .header { padding: 16px 20px; } } `; export default function App() { const [activeRoom, setActiveRoom] = useState(ROOMS[0]); const [selectedStone, setSelectedStone] = useState(STONES[0]); const [flash, setFlash] = useState(false); const flashRef = useRef(null); const handleStoneSelect = (stone) => { setFlash(true); setTimeout(() => setFlash(false), 300); setSelectedStone(stone); }; const handleRoomSelect = (room) => { setFlash(true); setTimeout(() => setFlash(false), 300); setActiveRoom(room); }; return ( <>
Asetica
Surface Visualizer
Beta Preview
{/* Visualizer */}
{activeRoom.label} {/* Stone overlay */}
{activeRoom.surfaces.map((surface, i) => (
))}
{/* Flash transition */}
{/* Surface label */}
{activeRoom.surfaceLabel}
{selectedStone.name}
{/* Sidebar */}
{/* Room tabs */}
{ROOMS.map((room) => ( ))}
{/* Stone picker */}
Choose a Surface
{STONES.length} colours available
{STONES.map((stone) => (
handleStoneSelect(stone)} > {stone.name}
{stone.name}
))}
{/* Footer */}
{selectedStone.name}
Selected surface
{selectedStone.name}
> ); }
Asetica Surface Visualizer
Asetica
Surface Visualiser
Preview
Benchtop
Taj Mahal