import 'twin.macro'; import {Children, createContext, useContext} from 'react'; import tw from 'twin.macro'; export default function FeatureWithCode({ children, title, }: { children: React.ReactNode; title?: string; }) { return (
{title && (

{title}

)}
{children}
); } export function CodeSample({children}: {children: React.ReactNode}) { return (
        {children}
      
); } type Variant = 'new' | 'change' | 'delete' | 'select'; const IsEvenContext = createContext(false); const VariantContext = createContext(null); export function SampleTableRow({ children, variant, }: { children: React.ReactNode; variant?: Variant; }) { const isEven = useContext(IsEvenContext); return ( {variant === 'new' ? '+' : variant === 'change' ? '⇄' : variant === 'delete' ? '-' : variant === 'select' ? '·' : ''} {children} ); } export function SampleTableCell({children}: {children: React.ReactNode}) { const variant = useContext(VariantContext); return ( {children} ); } export function SampleTable({ headers = ['email', 'active'], children, }: { headers?: string[]; children: React.ReactNode; }) { return ( {headers.map((h) => ( ))} {Children.map(children, (child, i) => ( {child} ))}
{h}
); }