import React, { forwardRef } from 'react' import type { HTMLAttributes, PropsWithChildren } from 'react' type TableCellVariant = 'data' | 'header' export interface TableCellProps extends HTMLAttributes { /** * ID to find this component in testing tools (e.g.: cypress, testing library, and jest). */ testId?: string /** * Specify if this component should be rendered as a header (``) or as a data cell (``). */ variant?: TableCellVariant /** * Defines the cells that the header element (``) relates to. * @see scope https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope */ scope?: 'col' | 'row' | 'rowgroup' | 'colgroup' /** * Defines how this component should be aligned. */ align?: 'left' | 'center' | 'right' } const TableCell = forwardRef< HTMLTableCellElement, PropsWithChildren >(function TableCell( { scope, align, children, variant = 'data', testId = 'fs-table-cell', ...otherProps }, ref ) { const Cell = variant === 'header' ? 'th' : 'td' return ( {children} ) }) export default TableCell