import classNames from 'classnames'; import { FC, useMemo } from 'react'; import { Schemas } from '@l-clutch/core'; type AreaTemplateRowProps = { row: TemplateRow; templateHeight: number; setBounds?: (ratioBounds: Schemas['RichMenuBounds']) => void; }; export const AreaTemplateRow: FC = ({ row, templateHeight, setBounds }) => { const gridTemplateColumns = useMemo(() => `repeat(${row.width}, 1fr)`, [row]); return (
{row.cols.map((col, index) => (
setBounds?.({ x: col.start / row.width, width: col.width / row.width, y: row.start / templateHeight, height: row.height / templateHeight, }) } > {col.name}
))}
); }; export type TemplateRow = { start: number; height: number; width: number; cols: TemplateCol[]; }; type TemplateCol = { name: string; start: number; width: number; };