Files
frigate/web/src/components/Table.jsx
T

60 lines
1.4 KiB
React
Raw Normal View History

2021-01-09 09:26:46 -08:00
import { h } from 'preact';
2021-01-19 08:44:18 -08:00
export function Table({ children, className = '' }) {
2021-01-18 10:49:00 -08:00
return (
<table className={`table-auto border-collapse text-gray-900 dark:text-gray-200 ${className}`}>{children}</table>
);
2021-01-09 09:26:46 -08:00
}
2021-02-14 10:47:59 -08:00
export function Thead({ children, className, ...attrs }) {
return (
<thead className={className} {...attrs}>
{children}
</thead>
);
2021-01-09 09:26:46 -08:00
}
2021-09-03 14:11:23 +02:00
export function Tbody({ children, className, reference, ...attrs }) {
2021-02-14 10:47:59 -08:00
return (
2021-09-03 14:11:23 +02:00
<tbody ref={reference} className={className} {...attrs}>
2021-02-14 10:47:59 -08:00
{children}
</tbody>
);
2021-01-09 09:26:46 -08:00
}
2021-02-14 10:47:59 -08:00
export function Tfoot({ children, className = '', ...attrs }) {
return (
<tfoot className={`${className}`} {...attrs}>
{children}
</tfoot>
);
2021-01-09 09:26:46 -08:00
}
2021-09-03 14:11:23 +02:00
export function Tr({ children, className = '', reference, ...attrs }) {
2021-02-04 16:18:15 -08:00
return (
<tr
2021-09-03 14:11:23 +02:00
ref={reference}
2021-02-04 16:18:15 -08:00
className={`border-b border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 ${className}`}
2021-02-14 10:47:59 -08:00
{...attrs}
2021-02-04 16:18:15 -08:00
>
{children}
</tr>
);
2021-01-09 09:26:46 -08:00
}
2021-02-14 10:47:59 -08:00
export function Th({ children, className = '', colspan, ...attrs }) {
2021-01-26 07:04:03 -08:00
return (
2021-02-14 10:47:59 -08:00
<th className={`border-b border-gray-400 p-2 px-1 lg:p-4 text-left ${className}`} colSpan={colspan} {...attrs}>
2021-01-26 07:04:03 -08:00
{children}
</th>
);
2021-01-09 09:26:46 -08:00
}
2021-09-03 14:11:23 +02:00
export function Td({ children, className = '', reference, colspan, ...attrs }) {
2021-01-26 07:04:03 -08:00
return (
2021-09-03 14:11:23 +02:00
<td ref={reference} className={`p-2 px-1 lg:p-4 ${className}`} colSpan={colspan} {...attrs}>
2021-01-26 07:04:03 -08:00
{children}
</td>
);
2021-01-09 09:26:46 -08:00
}