import React, { useState } from "react"; const CompositeSolidsWidget: React.FC = () => { const [isMerged, setIsMerged] = useState(false); const [w, setW] = useState(60); const [h, setH] = useState(80); const [d, setD] = useState(60); // Surface Area Calcs const singleSA = 2 * (w * h + w * d + h * d); const hiddenFaceArea = d * h; const totalSeparateSA = singleSA * 2; const mergedSA = totalSeparateSA - 2 * hiddenFaceArea; // Helper to generate a face style const getFaceStyle = ( width: number, height: number, transform: string, color: string, ) => ({ width: `${width}px`, height: `${height}px`, position: "absolute" as const, left: "50%", top: "50%", marginLeft: `-${width / 2}px`, marginTop: `-${height / 2}px`, transform: transform, backgroundColor: color, border: "1px solid rgba(255,255,255,0.3)", display: "flex", alignItems: "center", justifyContent: "center", backfaceVisibility: "hidden" as const, // Hide backfaces for cleaner look if opaque transition: "all 0.5s", }); // Prism Component const Prism = ({ positionX, baseHue, highlightSide, // 'left' or 'right' indicates the face to highlight red }: { positionX: number; baseHue: "indigo" | "sky"; highlightSide?: "left" | "right"; }) => { // Define shades based on hue // Lighting: Top is lightest, Front is base, Side is darkest const colors = baseHue === "indigo" ? { top: "#818cf8", front: "#6366f1", side: "#4f46e5" } // Indigo 400, 500, 600 : { top: "#38bdf8", front: "#0ea5e9", side: "#0284c7" }; // Sky 400, 500, 600 const hiddenColor = "#f43f5e"; // Rose 500 return (