link-stack/apps/bridge-frontend/app/_components/List.tsx

31 lines
610 B
TypeScript
Raw Normal View History

2024-03-04 13:52:20 +01:00
"use client";
import { FC } from "react";
2024-04-23 13:36:51 +02:00
import { GridColDef } from "@mui/x-data-grid-pro";
2024-03-04 13:52:20 +01:00
import { useRouter } from "next/navigation";
2024-04-23 13:36:51 +02:00
import { List as InternalList } from "ui";
2024-03-04 13:52:20 +01:00
interface ListProps {
title: string;
entity: string;
rows: any;
columns: GridColDef<any>[];
}
export const List: FC<ListProps> = ({ title, entity, rows, columns }) => {
const router = useRouter();
const onRowClick = (id: string) => {
router.push(`/${entity}/${id}`);
};
return (
2024-04-23 13:36:51 +02:00
<InternalList
title={title}
rows={rows}
columns={columns}
onRowClick={onRowClick}
/>
2024-03-04 13:52:20 +01:00
);
};