import { withProperties } from '@app/utils/typeHelpers';
type TBodyProps = {
children: React.ReactNode;
};
const TBody = ({ children }: TBodyProps) => {
return (
{children}
);
};
const TH = ({
children,
className,
...props
}: React.ComponentPropsWithoutRef<'th'>) => {
const style = [
'px-4 py-3 bg-gray-500 text-left text-xs leading-4 font-medium text-gray-200 uppercase tracking-wider truncate',
];
if (className) {
style.push(className);
}
return (
{children}
|
);
};
type TDProps = {
alignText?: 'left' | 'center' | 'right';
noPadding?: boolean;
};
const TD = ({
children,
alignText = 'left',
noPadding,
className,
...props
}: TDProps & React.ComponentPropsWithoutRef<'td'>) => {
const style = ['text-sm leading-5 text-white'];
switch (alignText) {
case 'left':
style.push('text-left');
break;
case 'center':
style.push('text-center');
break;
case 'right':
style.push('text-right');
break;
}
if (!noPadding) {
style.push('px-4 py-4');
}
if (className) {
style.push(className);
}
return (
{children}
|
);
};
type TableProps = {
children: React.ReactNode;
};
const Table = ({ children }: TableProps) => {
return (
);
};
export default withProperties(Table, { TH, TBody, TD });