import type { ReactElement, ReactNode } from "react"; import React from "react"; import { classNames } from "@calcom/lib"; export function VariantsTable({ children, titles, isDark, columnMinWidth = 150, }: { children: ReactElement | ReactElement[]; titles: string[]; isDark?: boolean; // Mainly useful on mobile, so components don't get squeesed columnMinWidth?: number; }) { const columns = React.Children.toArray(children) as ReactElement[]; return (
{columns.map((column) => ( {React.Children.count(column.props.children) && React.Children.map(column.props.children, (cell) => ( ))} ))}
{column.props.variant} {cell}
{!isDark && (
{children}
)}
); } interface RowProps { variant: string; children: ReactNode; } /** * There are two reasons we have this "empty" wrapper component: * 1. In order to have an isolate group per variant, which we iterate through in the table component. * 2. To have a way to pass the variant. */ export function VariantRow({ children }: RowProps) { return <>{children}; } export function RowTitles({ titles }: { titles: string[] }) { return ( {titles.map((title) => ( {title} ))} ); }