import React from 'react'; interface TableProps { children: React.ReactNode; className?: string; minWidth?: string; } interface TableContainerProps { children: React.ReactNode; className?: string; ref?: React.Ref; height?: string; bordered?: boolean; } interface TableHeadProps { children: React.ReactNode; className?: string; } interface TableRowProps { children: React.ReactNode; className?: string; onClick?: () => void; } interface TableCellProps { children?: React.ReactNode; className?: string; minWidth?: string; width?: string; align?: 'left' | 'right' | 'center'; } const TableContainer = React.forwardRef(({ children, className = '', height = 'auto', bordered = true }, ref) => { return (
{children}
); });; const Table: React.FC = ({ children, className = '', minWidth = 'min-w-[600px]' }) => { return ( {children}
); }; const TableHead: React.FC = ({ children, className = '' }) => { return ( {children} ); }; const TableBody: React.FC = ({ children, className = '' }) => { return ( tr:last-child]:border-b-0 ${className}`}> {children} ); }; const TableRow: React.FC = ({ children, className = '', onClick }) => { const baseClasses = "border-b border-[#D7D7D7] hover:bg-[#ECEEEF] dark:border-[#6A6A6A] dark:hover:bg-[#27282D]"; const cursorClass = onClick ? "cursor-pointer" : ""; return ( {children} ); }; const TableHeader: React.FC = ({ children, className = '', minWidth, width, align = 'left' }) => { const getAlignmentClass = () => { switch (align) { case 'right': return 'text-right'; case 'center': return 'text-center'; default: return 'text-left'; } }; const baseClasses = `px-2 py-3 text-sm font-medium text-gray-700 lg:px-3 dark:text-[#59636E] border-b border-[#D7D7D7] dark:border-[#6A6A6A] relative box-border ${getAlignmentClass()}`; const widthClasses = minWidth ? minWidth : ''; return ( {children} ); }; const TableCell: React.FC = ({ children, className = '', minWidth, width, align = 'left' }) => { const getAlignmentClass = () => { switch (align) { case 'right': return 'text-right'; case 'center': return 'text-center'; default: return 'text-left'; } }; const baseClasses = `px-2 py-2 text-sm lg:px-3 dark:text-[#E0E0E0] box-border ${getAlignmentClass()}`; const widthClasses = minWidth ? minWidth : ''; return ( {children} ); }; export { Table, TableContainer, TableHead, TableBody, TableRow, TableHeader, TableCell, }; export default Table;