import React, {
HTMLProps,
CSSProperties,
forwardRef,
FunctionComponent,
} from "react";
import classNames from "classnames";
import { bem } from "../../utilities/bem";
import { Skeleton } from "../Skeleton";
const cn = "TableCell";
export interface TableCellProps extends HTMLProps {
/**
* Removes all padding from the cell
*/
removePadding?: boolean;
/**
* Displays a `Skeleton` component to indicate loading is in progress
*/
isLoading?: boolean;
/**
* This will set the width for the entire column. Any valid CSS value for the `width`
* property is acceptable (e.g. "100px", "20%", etc.)
*/
columnWidth?: string;
ref?: any;
}
const TableCell: FunctionComponent = forwardRef<
HTMLTableCellElement,
TableCellProps
>(
(
{
className,
removePadding = false,
isLoading = false,
children,
columnWidth,
style,
...rest
},
ref,
) => {
const computedStyle: CSSProperties = { ...style };
if (columnWidth) {
computedStyle.width = columnWidth;
}
return (
|
{isLoading ? : children}
|
);
},
);
export default TableCell;