-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathevents-table.tsx
More file actions
52 lines (49 loc) · 1.29 KB
/
events-table.tsx
File metadata and controls
52 lines (49 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from "react";
import {
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "./ui/table";
import { cn } from "@/lib/utils";
import type { RouterOutputs } from "@/trpc/shared";
interface EventsTableProps {
events: RouterOutputs["post"]["getEvents"];
}
const EventsTable = ({ events }: EventsTableProps) => {
return (
<>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead className="w-min text-right">Date Time</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{events.map((event, index) => (
<TableRow key={index}>
<TableCell className="text-left font-medium">
{event.name}
</TableCell>
<TableCell
className={cn("text-right", {
"text-green-500": event.processed,
"text-orange-500": !event.processed,
})}
>
{event.date.toLocaleDateString("pl-PL", {
day: "2-digit",
month: "short",
year: "numeric",
hour: "numeric",
minute: "numeric",
})}
</TableCell>
</TableRow>
))}
</TableBody>
</>
);
};
export default EventsTable;