refactor: 코드 페이지 리팩토링

This commit is contained in:
2025-05-21 15:00:16 +09:00
parent 2889de235a
commit 0539b7f1f9
18 changed files with 1164 additions and 1082 deletions
@@ -42,22 +42,31 @@ function DataTable<T>({
<Table className={cn("w-full", className)} variant={variant}>
<THead table={table} />
<tbody>
{table.getRowModel().rows.map((row) => (
<TableRow
key={row.id}
onClick={() => onRowClick?.(row.original)}
className={cn(onRowClick && "cursor-pointer hover:bg-accent")}
>
{row.getVisibleCells().map((cell) => {
const { meta } = cell.column.columnDef;
return (
<TableCell key={cell.id} align="center" {...meta}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
);
})}
</TableRow>
))}
{table.getRowModel().rows.map((row) => {
const isSelectedRow = row.getIsSelected();
return (
<TableRow
key={row.id}
onClick={() => onRowClick?.(row.original)}
className={cn(
onRowClick && "cursor-pointer hover:bg-accent",
isSelectedRow && "!bg-primary-transparent",
)}
>
{row.getVisibleCells().map((cell) => {
const { meta } = cell.column.columnDef;
return (
<TableCell key={cell.id} align="center" {...meta}>
{flexRender(
cell.column.columnDef.cell,
cell.getContext(),
)}
</TableCell>
);
})}
</TableRow>
);
})}
</tbody>
</Table>
{viewPagination && <Pagination table={table} />}