-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharc-event-card.tsx
More file actions
63 lines (59 loc) · 1.76 KB
/
Copy patharc-event-card.tsx
File metadata and controls
63 lines (59 loc) · 1.76 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
53
54
55
56
57
58
59
60
61
62
63
"use client";
import { formatDate } from "date-fns";
import { pl } from "date-fns/locale";
import type { Resource } from "@/features/resources";
import { DeleteButtonWithDialog, EditButton } from "@/features/resources";
import type {
EditableResource,
ResourceDataType,
} from "@/features/resources/types";
import { ArcHideButtonWithDialog } from "./arc-hide-button-with-dialog";
export function EventCard({
event,
resource,
clickable,
}: {
event: ResourceDataType<Resource.CalendarEvents>;
resource: Resource;
clickable: boolean;
}) {
return (
<article
key={event.id}
className="bg-accent flex w-full justify-between rounded-md p-3 text-left text-sm"
title={event.description ?? ""}
>
<header>
<p className="font-medium">{event.name}</p>
<p className="mt-1 text-xs">
{event.startTime === event.endTime ? (
formatDate(event.startTime, "HH:mm", { locale: pl })
) : (
<>
{formatDate(event.startTime, "EEEE HH:mm", { locale: pl })}
{" — "}
{formatDate(event.endTime, "EEEE HH:mm", { locale: pl })}
</>
)}
</p>
</header>
{clickable ? (
<footer className="flex items-center">
{event.googleCalId == null ? null : (
<ArcHideButtonWithDialog
resource={resource as EditableResource}
googleCalId={event.googleCalId}
hidden={event.hidden}
/>
)}
<EditButton resource={resource as EditableResource} id={event.id} />
<DeleteButtonWithDialog
resource={resource}
itemName={event.name}
id={event.id}
/>
</footer>
) : null}
</article>
);
}