import React, { useEffect, useRef, useState } from "react"; // Tailwind-only, self-contained demo of a chicer section with refined typography // Fixes: multiline className now uses template literals; CSS variable object uses // quoted keys compatible with React inline styles. Added lightweight runtime tests // via console.assert so we have at least some test coverage in this demo file. export default function ChicSectionRedesign() { const [scheme, setScheme] = useState<"classic" | "deep">("deep"); const rootRef = useRef(null); // Base class tokens; switch palette tokens by scheme const base = "min-h-screen w-full antialiased selection:bg-emerald-200/40"; const wrapperClass = `${base}${ scheme === "deep" ? " bg-[--bg] text-[--ink]" : " bg-[--bg-classic] text-[--ink-classic]" }`; // CSS custom properties for both palettes (quoted keys are important) const cssVars = { // Deep palette (elegant emerald & muted gold) "--bg": "#0e1a18", "--panel": "#0f2422", "--panel-2": "#0c1e1c", "--line": "#20443f", "--ink": "#e9efe9", "--muted": "#a8b6b0", "--accent": "#c9a86a", "--accent-2": "#b69158", "--glow": "#1d4f47", // Classic (lighter two-tone) "--bg-classic": "#f7f6f3", "--panel-classic": "#ffffff", "--line-classic": "#e6e2d9", "--ink-classic": "#1d2321", "--muted-classic": "#66736f", "--accent-classic": "#c2a36b", } as React.CSSProperties; // --- Lightweight Runtime Tests (console.assert) --- // These give us sanity checks in lieu of a formal test runner here. useEffect(() => { const el = rootRef.current; if (!el) return; const cs = getComputedStyle(el); // Test 1: required CSS variables exist console.assert(cs.getPropertyValue("--bg").trim().length > 0, "Test fail: --bg not set"); console.assert(cs.getPropertyValue("--ink").trim().length > 0, "Test fail: --ink not set"); // Test 2: class token switches by scheme const hasDeep = el.className.includes("bg-[--bg]"); const hasClassic = el.className.includes("bg-[--bg-classic]"); console.assert( (scheme === "deep" && hasDeep && !hasClassic) || (scheme === "classic" && hasClassic && !hasDeep), "Test fail: scheme class tokens not applied correctly" ); // Test 3: accent swatch renders a gradient chip later via inline style (smoke test) // Not strict, but ensures the component mounted and has palette entries console.assert(document.querySelectorAll("[data-swatch]").length >= 6, "Test fail: swatches missing"); }, [scheme]); return (
{/* Top bar with scheme toggle */}
Preview
{/* Section wrapper */}
{/* Soft gradient wash for depth */}
); }