refactor(admin): refactor admin roles and users management
This commit is contained in:
47
src/app/(modules)/roles/components/RoleTable.tsx
Normal file
47
src/app/(modules)/roles/components/RoleTable.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
'use client';
|
||||
|
||||
import type { ColumnDef } from '@tanstack/react-table';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import { DataTable } from '@/components/data-table';
|
||||
import type { Role } from '@/types';
|
||||
|
||||
interface RoleTableProps {
|
||||
columns: ColumnDef<Role>[];
|
||||
roles: Role[];
|
||||
isLoading: boolean;
|
||||
toolbar: ReactNode;
|
||||
skip: number;
|
||||
limit: number;
|
||||
total: number;
|
||||
onPageChange: (skip: number) => void;
|
||||
}
|
||||
|
||||
export function RoleTable({
|
||||
columns,
|
||||
roles,
|
||||
isLoading,
|
||||
toolbar,
|
||||
skip,
|
||||
limit,
|
||||
total,
|
||||
onPageChange,
|
||||
}: RoleTableProps) {
|
||||
return (
|
||||
<DataTable
|
||||
title="Roles"
|
||||
columns={columns}
|
||||
data={roles}
|
||||
isLoading={isLoading}
|
||||
toolbar={toolbar}
|
||||
emptyTitle="No roles found."
|
||||
pagination={{
|
||||
skip,
|
||||
limit,
|
||||
totalItems: total,
|
||||
onPageChange,
|
||||
onLimitChange: () => undefined,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user