news table update

This commit is contained in:
2024-03-01 01:04:23 -05:00
parent 18f95460a2
commit 813d5ee5c5
6 changed files with 275 additions and 114 deletions
+5 -4
View File
@@ -32,9 +32,9 @@ export function NewsTable<TData, TValue>({
});
return (
<div className="rounded-md border">
<div className="h-full">
<Table>
<TableHeader>
{/* <TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => {
@@ -51,16 +51,17 @@ export function NewsTable<TData, TValue>({
})}
</TableRow>
))}
</TableHeader>
</TableHeader> */}
<TableBody>
{table.getRowModel().rows?.length ? (
table.getRowModel().rows.map((row) => (
<TableRow
key={row.id}
data-state={row.getIsSelected() && "selected"}
className="text-white"
>
{row.getVisibleCells().map((cell) => (
<TableCell key={cell.id}>
<TableCell key={cell.id} className="p-1 pl-4 overflow-hidden">
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
))}
+23 -4
View File
@@ -7,13 +7,32 @@ export const newsColumns: ColumnDef<newsDataType>[] = [
{
accessorKey: "headline",
header: "Headline",
},
{
accessorKey: "dateTime",
header: "Time",
cell: ({ row }) => {
const headline: string = row.getValue("headline");
return (
<div className="max-w-[450px] whitespace-nowrap overflow-hidden text-ellipsis">
{headline}
</div>
);
},
},
{
accessorKey: "outlet",
header: "Outlet",
},
{
accessorKey: "dateTime",
header: "Time",
cell: ({ row }) => {
const zuluTime: string = row.getValue("dateTime");
const toDate = new Date(zuluTime);
const formattedDate = toDate.toLocaleTimeString("en-us", {
hour: "2-digit",
minute: "2-digit",
});
return <div>{formattedDate}</div>;
},
},
];