Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
feat(components): add a Link to the problem page in DataTable for `…
Browse files Browse the repository at this point in the history
…/problems`

  ## what
  - add a Link to the problem page in `DataTable` for `/problems`

  ## how

  ## why
  - need to be able to go the problem page for a specific problem number

  ## where
  - ./src/app/problems/components/data-table/columns.tsx

  ## usage
  • Loading branch information
Clumsy-Coder committed Jan 2, 2024
1 parent 29fa0e2 commit e9c16f5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/app/problems/components/data-table/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { ColumnDef } from "@tanstack/react-table"
import { ArrowUpDown, MoreHorizontal } from "lucide-react"
import Link from "next/link";

import { Button } from "@/components/ui/button"

Expand All @@ -24,6 +25,18 @@ export const columns: ColumnDef<Payment>[] = [
Problem number
<ArrowUpDown className="ml-2 h-4 w-4" />
</Button>
);
},
cell: ({ row }) => {
return (
<div className="hover:underline">
<Link
href={`/problems/${row.getValue("num")}`}
className="p-3"
>
{row.getValue("num")}
</Link>
</div>
)
},
},
Expand All @@ -38,6 +51,18 @@ export const columns: ColumnDef<Payment>[] = [
Problem Title
<ArrowUpDown className="ml-2 h-4 w-4" />
</Button>
);
},
cell: ({ row }) => {
return (
<div className="hover:underline">
<Link
href={`/problems/${row.getValue("num")}`}
className="p-3"
>
{row.getValue("title")}
</Link>
</div>
)
},
},
Expand Down

0 comments on commit e9c16f5

Please sign in to comment.