59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import dayjs from "dayjs";
|
|
import type { ColumnDef } from "@tanstack/react-table";
|
|
import type { MyPost, NoticePost } from "@/entities/post";
|
|
import type { Schedule } from "../api/schedule-service";
|
|
|
|
const noticePostTableColumns: ColumnDef<NoticePost>[] = [
|
|
{
|
|
accessorKey: "pstTtl",
|
|
header: "제목",
|
|
},
|
|
{
|
|
accessorKey: "wrtrNm",
|
|
header: "작성자",
|
|
},
|
|
{
|
|
accessorKey: "regDt",
|
|
header: "작성일",
|
|
cell: ({ row }) => dayjs(row.original.regDt).format("YYYY-MM-DD"),
|
|
},
|
|
{
|
|
accessorKey: "inqNocs",
|
|
header: "조회수",
|
|
},
|
|
];
|
|
|
|
const myPostTableColumns: ColumnDef<MyPost>[] = [
|
|
{
|
|
accessorKey: "pstTtl",
|
|
header: "제목",
|
|
},
|
|
{
|
|
accessorKey: "regDt",
|
|
header: "작성일",
|
|
cell: ({ row }) => dayjs(row.original.regDt).format("YYYY-MM-DD"),
|
|
},
|
|
];
|
|
|
|
|
|
const scheduleTableColumns: ColumnDef<Schedule>[] = [
|
|
{
|
|
accessorKey: "schdlTtl",
|
|
header: "주요일정",
|
|
cell: ({ row }) => {
|
|
const startDate = dayjs(row.original.schdlBgngDt).format("YYYY-MM-DD");
|
|
const endDate = dayjs(row.original.schdlEndDt).format("YYYY-MM-DD");
|
|
const schdlTtl = row.original.schdlTtl;
|
|
return (
|
|
<div className="text-left">
|
|
[{startDate} ~ {endDate}]<br />{schdlTtl}
|
|
</div>
|
|
);
|
|
},
|
|
},
|
|
];
|
|
|
|
|
|
|
|
export { noticePostTableColumns, myPostTableColumns, scheduleTableColumns };
|