import { ReactNode, useState } from "react"; const titleHeight = 32; type PlaygroundTileProps = { title?: string; children?: ReactNode; className?: string; childrenClassName?: string; padding?: boolean; backgroundColor?: string; }; export type PlaygroundTab = { title: string; content: ReactNode; }; export type PlaygroundTabbedTileProps = { tabs: PlaygroundTab[]; initialTab?: number; } & PlaygroundTileProps; export const PlaygroundTile: React.FC = ({ children, title, className, childrenClassName, padding = true, backgroundColor = "transparent", }) => { const contentPadding = padding ? 4 : 0; return (
{title && (

{title}

)}
{children}
); }; export const PlaygroundTabbedTile: React.FC = ({ tabs, initialTab = 0, className, childrenClassName, backgroundColor = "transparent", }) => { const contentPadding = 4; const [activeTab, setActiveTab] = useState(initialTab); if (activeTab >= tabs.length) { return null; } return (
{tabs.map((tab, index) => ( ))}
{tabs.map((tab, index) => (
{tab.content}
))}
); };