Skip to content

Commit

Permalink
feat(fe): add writer section at notice table (#1119)
Browse files Browse the repository at this point in the history
* fix: auto layout to fixed layout

* feat(fe): notice table add writer column

---------

Co-authored-by: dayongkr <dayongkr@gmail.com>
  • Loading branch information
jihorobert and dayongkr authored Jan 2, 2024
1 parent 9952b26 commit dc35680
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions frontend-client/app/notice/_components/NoticeTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TableHeader,
TableRow
} from '@/components/ui/table'
import { cn } from '@/lib/utils'
import type { ColumnDef } from '@tanstack/react-table'
import {
flexRender,
Expand Down Expand Up @@ -44,25 +45,47 @@ export default function NoticeTable({ data, currentPage }: NoticeTableProps) {
<PiPushPinFill />
</div>
)}
<span className="text-sm md:text-base">{row.original.title}</span>
<span
className={cn(
row.original.isFixed && 'font-semibold',
'text-sm md:text-base'
)}
>
{row.original.title}
</span>
</div>
)
}
},
{
header: () => (
<div className="flex justify-end">
<span className="flex w-24 justify-center md:w-32">Date</span>
</div>
<p className="text-center">
<span>Writer</span>
</p>
),
accessorKey: 'createdBy',
cell: ({ row }) => {
return (
<p className="text-center">
<span className="text-xs md:text-sm">{row.original.createdBy}</span>
</p>
)
}
},
{
header: () => (
<p className="text-center">
<span>Date</span>
</p>
),
accessorKey: 'createTime',
cell: ({ row }) => {
return (
<div className="flex justify-end text-gray-500">
<span className="text eli flex w-24 justify-center text-xs md:w-32 md:text-sm">
<p className="text-center">
<span className="text-xs md:text-sm">
{dayjs(row.original.createTime).format('YYYY-MM-DD')}
</span>
</div>
</p>
)
}
}
Expand All @@ -77,13 +100,20 @@ export default function NoticeTable({ data, currentPage }: NoticeTableProps) {
const router = useRouter()

return (
<Table>
<Table className="table-fixed">
<TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => {
return (
<TableHead key={header.id}>
<TableHead
key={header.id}
className={
header.column.columnDef.header === 'Title'
? 'w-[60%] md:w-[64%]'
: 'w-[20%] md:w-[18%]'
}
>
{header.isPlaceholder
? null
: flexRender(
Expand Down

0 comments on commit dc35680

Please sign in to comment.