const { useState } = React;
const { Badge, StatPill } = window.SpecComponents;
const CardGrid = ({ functionalities }) => {
const [selected, setSelected] = useState(null);
const selectedFunc = functionalities.find(f => f.id === selected);
return (
{functionalities.map(func => {
const req = func.requirements.filter(r => r.level === "required").length;
const rec = func.requirements.filter(r => r.level === "recommended").length;
const isActive = selected === func.id;
const total = func.requirements.length;
const reqPct = total ? Math.round((req / total) * 100) : 0;
return (
);
})}
{selectedFunc && (
{selectedFunc.icon}
{selectedFunc.name}
{selectedFunc.description}
{selectedFunc.requirements.map(req => (
{req.id}
{req.title}
{req.detail}
))}
)}
);
};
window.SpecComponents = window.SpecComponents || {};
window.SpecComponents.CardGrid = CardGrid;