// product-visual.jsx — プレースホルダー商品ビジュアル // プロシージャルなSVG/CSSで「液体メタル風」「ガラス風」のオブジェを描画 function ProductVisual({ product, theme = "obsidian" }) { const { hue, id, cat } = product; // テーマごとに色味を変える const palette = { obsidian: { base: `oklch(0.22 0.04 ${hue})`, mid: `oklch(0.42 0.08 ${hue})`, hi: `oklch(0.78 0.10 ${hue})`, glow: `oklch(0.88 0.14 ${hue})`, }, porcelain: { base: `oklch(0.92 0.02 ${hue})`, mid: `oklch(0.78 0.04 ${hue})`, hi: `oklch(0.55 0.10 ${hue})`, glow: `oklch(0.65 0.18 ${hue})`, }, hologram: { base: `oklch(0.30 0.08 ${hue})`, mid: `oklch(0.55 0.18 ${(hue + 60) % 360})`, hi: `oklch(0.85 0.20 ${(hue + 120) % 360})`, glow: `oklch(0.92 0.24 ${(hue + 180) % 360})`, }, }[theme]; // 商品IDをハッシュしてシェイプを決定 const shapeIdx = parseInt(id.replace(/\D/g, ""), 10) % 4; return (
{/* 背景の浮遊光 */} {shapeIdx === 0 && ( <> {/* 縦長カプセル(万年筆・ボトル系) */} )} {shapeIdx === 1 && ( <> {/* 球体(香水・ディフューザー系) */} )} {shapeIdx === 2 && ( <> {/* 立方体・パズル系 */} )} {shapeIdx === 3 && ( <> {/* 有機的な液滴 */} )} {/* 反射ハイライト */}
{cat}
); } window.ProductVisual = ProductVisual;