65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import React from 'react'
|
|
import clsx from 'clsx'
|
|
|
|
export const TableContainer: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({
|
|
children,
|
|
className,
|
|
...props
|
|
}) => (
|
|
<div className={clsx('w-full overflow-x-auto', className)} {...props}>
|
|
<table className="w-full border-collapse text-left">{children}</table>
|
|
</div>
|
|
)
|
|
|
|
export const TableHead: React.FC<React.HTMLAttributes<HTMLTableSectionElement>> = ({
|
|
children,
|
|
className,
|
|
...props
|
|
}) => (
|
|
<thead
|
|
className={clsx('bg-slate-50/70 border-y border-slate-200/80 text-[11px] font-semibold uppercase tracking-wider text-slate-400', className)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</thead>
|
|
)
|
|
|
|
export const TableBody: React.FC<React.HTMLAttributes<HTMLTableSectionElement>> = ({
|
|
children,
|
|
className,
|
|
...props
|
|
}) => (
|
|
<tbody className={clsx('divide-y divide-slate-100 bg-white text-sm text-slate-700', className)} {...props}>
|
|
{children}
|
|
</tbody>
|
|
)
|
|
|
|
export const TableRow: React.FC<React.HTMLAttributes<HTMLTableRowElement>> = ({
|
|
children,
|
|
className,
|
|
...props
|
|
}) => (
|
|
<tr className={clsx('hover:bg-slate-50/70 transition-colors', className)} {...props}>
|
|
{children}
|
|
</tr>
|
|
)
|
|
|
|
export const TableHeaderCell: React.FC<React.ThHTMLAttributes<HTMLTableCellElement>> = ({
|
|
children,
|
|
className,
|
|
...props
|
|
}) => (
|
|
<th className={clsx('px-5 py-3 font-semibold', className)} {...props}>
|
|
{children}
|
|
</th>
|
|
)
|
|
|
|
export const TableCell: React.FC<React.TdHTMLAttributes<HTMLTableCellElement>> = ({
|
|
children,
|
|
className,
|
|
...props
|
|
}) => (
|
|
<td className={clsx('px-5 py-3.5 align-middle', className)} {...props}>
|
|
{children}
|
|
</td>
|
|
)
|