diff --git a/compass/app/admin/page.tsx b/compass/app/admin/page.tsx index e803aad..9307b93 100644 --- a/compass/app/admin/page.tsx +++ b/compass/app/admin/page.tsx @@ -1,7 +1,12 @@ - "use client"; // import Table from "@/components/Table"; -import { ColumnDef, createColumnHelper, flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-table"; +import { + ColumnDef, + createColumnHelper, + flexRender, + getCoreRowModel, + useReactTable, +} from "@tanstack/react-table"; import { useState } from "react"; import usersImport from "./users.json"; @@ -16,26 +21,28 @@ type User = { program: "DOMESTIC" | "ECONOMIC" | "COMMUNITY"; experience: number; group?: string; -} +}; -// TODO: Example data. Remove later. +import { PageLayout } from "@/components/admin/PageLayout"; + +import { BookmarkIcon } from "@heroicons/react/24/solid"; export default function Page() { const columnHelper = createColumnHelper(); const columns = [ columnHelper.accessor("username", { - cell: info => info.getValue(), + cell: (info) => info.getValue(), }), columnHelper.accessor("role", { - cell: info => info.renderValue(), + cell: (info) => info.renderValue(), }), columnHelper.accessor("email", { - cell: info => info.renderValue(), + cell: (info) => info.renderValue(), }), columnHelper.accessor("program", { - cell: info => info.renderValue(), - }) + cell: (info) => info.renderValue(), + }), ]; const [data, setData] = useState([...usersExample]); @@ -45,53 +52,40 @@ export default function Page() { data, getCoreRowModel: getCoreRowModel(), }); - return ( - <> -

This is example data!!

- - - - {table.getHeaderGroups().map(headerGroup => ( - - {headerGroup.headers.map(header => ( - - ))} - - ))} - - - {table.getRowModel().rows.map(row => ( - - {row.getVisibleCells().map(cell => ( - - ))} - - ))} - -
- {header.isPlaceholder - ? null - : flexRender( - header.column.columnDef.header, - header.getContext() - )} -
- {flexRender(cell.column.columnDef.cell, cell.getContext())} -
- ); - - - -import { PageLayout } from "@/components/admin/PageLayout" - -import { BookmarkIcon } from "@heroicons/react/24/solid" - -export default function Page() { - return ( -
- {/* icon + title */} - } /> -
- ) +
+ {/* icon + title */} + }> + + + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => ( + + ))} + + ))} + + + {table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + ))} + + ))} + +
+ {header.isPlaceholder + ? null + : flexRender( + header.column.columnDef.header, + header.getContext() + )} +
+ {flexRender(cell.column.columnDef.cell, cell.getContext())} +
+
+
+ ); } diff --git a/compass/components/admin/PageLayout.tsx b/compass/components/admin/PageLayout.tsx index f27a96a..80a96f5 100644 --- a/compass/components/admin/PageLayout.tsx +++ b/compass/components/admin/PageLayout.tsx @@ -1,7 +1,7 @@ interface PageLayoutProps { icon: React.ReactElement; title: string; - // table: React.ReactElement + children: React.ReactElement } export const PageLayout: React.FC = ({ icon, title, children }) => {