feat: 사이트 상세(수정) 페이지 데이터 바인딩 작업

This commit is contained in:
2025-03-12 16:56:47 +09:00
parent 108e2a8746
commit 0588bf0d7f
30 changed files with 529 additions and 127 deletions
@@ -14,7 +14,7 @@ const meta: Meta<typeof DataTable> = {
description: {
component: `
- [Docs](https://tanstack.com/table/v8/docs/introduction)
`,
`,
},
source: {
code: `
@@ -36,15 +36,22 @@ function THead<T>({ table }: { table: TableType<T> }) {
);
}
type TableProps<T> = { table: TableType<T> };
type TableProps<T> = {
table: TableType<T>;
onRowClick?: (row: T) => void;
};
function DataTable<T>({ table }: TableProps<T>) {
function DataTable<T>({ table, onRowClick }: TableProps<T>) {
return (
<Table className="w-full">
<THead table={table} />
<tbody>
{table.getRowModel().rows.map((row) => (
<TableRow key={row.id}>
<TableRow
key={row.id}
onClick={() => onRowClick?.(row.original)}
className={onRowClick ? "cursor-pointer hover:bg-muted" : ""}
>
{row.getVisibleCells().map((cell) => {
const { meta } = cell.column.columnDef;
return (