"use client";

import type { ColumnDef } from "@tanstack/react-table";
import Link from "next/link";
import { DataTableColumnHeader } from "@/components/ui/data-table-column-header";
import type { getPostBySlug } from "@/lib/content";

type Post = Awaited<ReturnType<typeof getPostBySlug>>;

export const columns: ColumnDef<Post>[] = [
  {
    accessorKey: "title",
    header: "Title",
    cell: ({ row }) => (
      <Link href={`/${row.original.slug}`}>{row.getValue("title")}</Link>
    ),
  },
  {
    accessorKey: "publishedAt",
    header: ({ column }) => (
      <DataTableColumnHeader column={column} title="Published At" />
    ),
  },
];
