refactor: modularize road management modules
This commit is contained in:
51
src/app/(modules)/project/components/ProjectTable.tsx
Normal file
51
src/app/(modules)/project/components/ProjectTable.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
'use client';
|
||||
|
||||
import type { ColumnDef } from '@tanstack/react-table';
|
||||
|
||||
import { DataTable } from '@/components/data-table';
|
||||
import type { Project } from '@/types';
|
||||
|
||||
interface ProjectTableProps {
|
||||
columns: ColumnDef<Project>[];
|
||||
projects: Project[];
|
||||
isLoading: boolean;
|
||||
skip: number;
|
||||
limit: number;
|
||||
total: number;
|
||||
onPageChange: (skip: number) => void;
|
||||
onLimitChange: (limit: number) => void;
|
||||
onEdit: (project: Project) => void;
|
||||
onDelete: (project: Project) => void;
|
||||
}
|
||||
|
||||
export function ProjectTable({
|
||||
columns,
|
||||
projects,
|
||||
isLoading,
|
||||
skip,
|
||||
limit,
|
||||
total,
|
||||
onPageChange,
|
||||
onLimitChange,
|
||||
onEdit,
|
||||
onDelete,
|
||||
}: ProjectTableProps) {
|
||||
return (
|
||||
<DataTable
|
||||
title="Projects"
|
||||
data={projects}
|
||||
columns={columns}
|
||||
onEdit={onEdit}
|
||||
onDelete={onDelete}
|
||||
isLoading={isLoading}
|
||||
emptyTitle="No projects found."
|
||||
pagination={{
|
||||
skip,
|
||||
limit,
|
||||
totalItems: total,
|
||||
onPageChange,
|
||||
onLimitChange,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user