import classNames from 'classnames'; import * as React from 'react'; function notEmpty(val: any) { return val !== undefined && val !== null; } export interface CellProps { itemPrefixCls: string; span: number; className?: string; component: string; style?: React.CSSProperties; labelStyle?: React.CSSProperties; contentStyle?: React.CSSProperties; bordered?: boolean; label?: React.ReactNode; content?: React.ReactNode; colon?: boolean; } const Cell: React.FC = (props) => { const { itemPrefixCls, component, span, className, style, labelStyle, contentStyle, bordered, label, content, colon, } = props; const Component = component as keyof JSX.IntrinsicElements; if (bordered) { return ( {notEmpty(label) && {label}} {notEmpty(content) && {content}} ); } return (
{(label || label === 0) && ( {label} )} {(content || content === 0) && ( {content} )}
); }; export default Cell;