diff --git a/src/components/DataTable.tsx b/src/components/DataTable.tsx
index 99b8152..b9186d5 100644
--- a/src/components/DataTable.tsx
+++ b/src/components/DataTable.tsx
@@ -1,113 +1,112 @@
import {
- flexRender,
- getCoreRowModel,
- useReactTable,
- getPaginationRowModel,
- SortingState,
- getSortedRowModel,
+ flexRender,
+ getCoreRowModel,
+ useReactTable,
+ getPaginationRowModel,
+ getSortedRowModel,
} from "@tanstack/react-table"
import { Button } from "./ui/button"
import {
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
} from "@/components/ui/table"
import { useState } from "react"
export function DataTable({ columns, data, loading }) {
- const [sorting, setSorting] = useState([])
- const table = useReactTable({
- data,
- columns,
- getCoreRowModel: getCoreRowModel(),
- getPaginationRowModel: getPaginationRowModel(),
- onSortingChange: setSorting,
- getSortedRowModel: getSortedRowModel(),
- state: {
- sorting,
- },
- })
+ const [sorting, setSorting] = useState([])
+ const table = useReactTable({
+ data,
+ columns,
+ getCoreRowModel: getCoreRowModel(),
+ getPaginationRowModel: getPaginationRowModel(),
+ onSortingChange: setSorting,
+ getSortedRowModel: getSortedRowModel(),
+ state: {
+ sorting,
+ },
+ })
- const pageCount = table.getPageCount()
- const currentPage = table.getState().pagination?.pageIndex
- return (
-
-
-
-
- {table.getHeaderGroups().map((headerGroup) => (
-
- {headerGroup.headers.map((header) => {
- return (
-
- {header.isPlaceholder
- ? null
- : flexRender(
- header.column.columnDef.header,
- header.getContext(),
- )}
-
- )
- })}
-
- ))}
-
-
- {table.getRowModel().rows?.length ? (
- table.getRowModel().rows.map((row) => (
-
- {row.getVisibleCells().map((cell) => (
-
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
-
- ))}
-
- ))
- ) : loading ? (
-
-
- Loading...
-
-
- ) : (
-
-
- No results.
-
-
- )}
-
-
-
-
-
- {`${currentPage + 1} of ${pageCount}`}
-
-
-
-
-
-
-
- )
+ const pageCount = table.getPageCount()
+ const currentPage = table.getState().pagination?.pageIndex
+ return (
+
+
+
+
+ {table.getHeaderGroups().map((headerGroup) => (
+
+ {headerGroup.headers.map((header) => {
+ return (
+
+ {header.isPlaceholder
+ ? null
+ : flexRender(
+ header.column.columnDef.header,
+ header.getContext(),
+ )}
+
+ )
+ })}
+
+ ))}
+
+
+ {table.getRowModel().rows?.length ? (
+ table.getRowModel().rows.map((row) => (
+
+ {row.getVisibleCells().map((cell) => (
+
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
+
+ ))}
+
+ ))
+ ) : loading ? (
+
+
+ Loading...
+
+
+ ) : (
+
+
+ No results.
+
+
+ )}
+
+
+
+
+
+ {`${currentPage + 1} of ${pageCount}`}
+
+
+
+
+
+
+
+ )
}
diff --git a/src/templates/Tag.tsx b/src/templates/Tag.tsx
index 3351f86..896de28 100644
--- a/src/templates/Tag.tsx
+++ b/src/templates/Tag.tsx
@@ -1,7 +1,47 @@
import { useParams } from "react-router"
import Page from "./Page"
+import { useQuery } from "@tanstack/react-query"
+import api from "@/api/eolas-api"
+import { DataTable } from "@/components/DataTable"
+import { ArrowUpDown } from "lucide-react"
+import { Button } from "@/components/ui/button"
+import { Link } from "react-router"
+
+const columns = [
+ {
+ accessorKey: "entry_title",
+ header: ({ column }) => {
+ return (
+
+ )
+ },
+ cell: ({ cell, row }) => {
+ return (
+
+
+ {row.original.entry_title.replace(/_/g, " ")}
+
+
+ )
+ },
+ },
+]
+
export default function Tag() {
const { tag } = useParams()
+
+ const { data, isLoading } = useQuery({
+ queryKey: [`entries_for_tag_${tag}`],
+ queryFn: () => api.get(`/entries/tag/${tag}`).then((res) => res.data),
+ })
+
return (
{tag}
>
}
+ pageBody={}
/>
)
}