import dayjs from "dayjs"; import type { ColumnDef } from "@tanstack/react-table"; import { Badge } from "@common/components"; import type { RecentPost } from "@/entities/post"; const noticePostTableColumns: ColumnDef[] = [ { header: "번호", cell: ({ row, table }) => { if (row.original.upndFixYn === "Y") { return ( ); } const totalRows = table.getRowCount(); const currentPage = table.getState().pagination.pageIndex; const pageSize = table.getState().pagination.pageSize; return totalRows - (currentPage * pageSize + row.index); }, }, { accessorKey: "pstTtl", header: "제목", }, { accessorKey: "wrtrNm", header: "작성자", }, { accessorKey: "regDt", header: "작성일", cell: ({ row }) => dayjs(row.original.regDt).format("YYYY-MM-DD"), }, { accessorKey: "inqNocs", header: "조회수", }, ]; const recentPostTableColumns: ColumnDef[] = [ { header: "번호", cell: ({ row, table }) => { const totalRows = table.getRowCount(); const currentPage = table.getState().pagination.pageIndex; const pageSize = table.getState().pagination.pageSize; return totalRows - (currentPage * pageSize + row.index); }, }, { accessorKey: "pstTtl", header: "제목", }, { accessorKey: "wrtrNm", header: "작성자", }, { accessorKey: "regDt", header: "작성일", cell: ({ row }) => dayjs(row.original.regDt).format("YYYY-MM-DD"), }, { accessorKey: "inqNocs", header: "조회수", }, ]; export { noticePostTableColumns, recentPostTableColumns };