import type { ComponentType } from "../api/types"; import { Badge } from "../incidents/Badge"; import { useState } from "react"; export const Component = ({ name, status, children }: ComponentType) => { const [showChildren, setShowChildren] = useState(false); const Chevron = showChildren ? ( ) : ( ); const isClickable = Boolean(children?.length); const Box = ({ children: boxChildren, clickable, className, onClick, }: { children: React.ReactNode; clickable?: boolean; className?: string; onClick?: () => void; }) => (
{boxChildren}
); return ( <> setShowChildren(!showChildren)} clickable={isClickable} >
{children ? Chevron : null} {name}{" "}
{status === "unknown" && children ? null : }
{showChildren ? children?.map((child) => ( {child.name} )) : null} ); };