41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import * as React from 'react';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
export function Table({ className, ...props }: React.TableHTMLAttributes<HTMLTableElement>) {
|
|
return <table className={cn('w-full min-w-[720px] caption-bottom text-sm', className)} {...props} />;
|
|
}
|
|
|
|
export function TableContainer({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
return (
|
|
<div
|
|
className={cn(
|
|
'w-full max-w-full overflow-x-auto overscroll-x-contain [-webkit-overflow-scrolling:touch]',
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function TableHeader({ className, ...props }: React.HTMLAttributes<HTMLTableSectionElement>) {
|
|
return <thead className={cn('[&_tr]:border-b', className)} {...props} />;
|
|
}
|
|
|
|
export function TableBody({ className, ...props }: React.HTMLAttributes<HTMLTableSectionElement>) {
|
|
return <tbody className={cn('[&_tr:last-child]:border-0', className)} {...props} />;
|
|
}
|
|
|
|
export function TableRow({ className, ...props }: React.HTMLAttributes<HTMLTableRowElement>) {
|
|
return <tr className={cn('border-b border-[#eceef4] transition-colors hover:bg-[#f8f9fb]', className)} {...props} />;
|
|
}
|
|
|
|
export function TableHead({ className, ...props }: React.ThHTMLAttributes<HTMLTableCellElement>) {
|
|
return <th className={cn('h-11 px-4 text-left align-middle font-medium text-[#667085]', className)} {...props} />;
|
|
}
|
|
|
|
export function TableCell({ className, ...props }: React.TdHTMLAttributes<HTMLTableCellElement>) {
|
|
return <td className={cn('p-4 align-middle', className)} {...props} />;
|
|
}
|