-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPerformanceInfo.tsx
More file actions
66 lines (58 loc) · 1.86 KB
/
Copy pathPerformanceInfo.tsx
File metadata and controls
66 lines (58 loc) · 1.86 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
64
65
66
import { Performance, Session } from "@/types/performance";
import { Calendar, MapPin } from "lucide-react";
interface PerformanceInfoProps {
performance: Performance;
sessions?: Session[];
venueName?: string;
}
export default function PerformanceInfo({
performance,
sessions,
venueName,
}: PerformanceInfoProps) {
let dateDisplay = "";
if (sessions && sessions.length > 0) {
const dates = sessions.map((s) => new Date(s.sessionDate).getTime());
const minDate = new Date(Math.min(...dates));
const maxDate = new Date(Math.max(...dates));
const formatDate = (d: Date) =>
d.toLocaleDateString("ko-KR", {
year: "numeric",
month: "long",
day: "numeric",
});
if (minDate.getTime() === maxDate.getTime()) {
dateDisplay = formatDate(minDate);
} else {
dateDisplay = `${formatDate(minDate)} ~ ${formatDate(maxDate)}`;
}
}
return (
<div className="h-full flex flex-col justify-center w-full">
<div className="inline-block bg-white/20 backdrop-blur-sm px-4 py-2 rounded-full mb-4">
<span className="text-sm">다음 티켓팅</span>
</div>
<h2 className="text-3xl md:text-4xl mb-4">
{performance.performance_name}
</h2>
<div className="space-y-3 mb-6">
<div className="flex items-center gap-3">
<Calendar className="w-5 h-5 text-white/80" />
<span>
{dateDisplay || (
<span className="animate-pulse bg-white/20 rounded h-5 w-48 inline-block" />
)}
</span>
</div>
<div className="flex items-center gap-3">
<MapPin className="w-5 h-5 text-white/80" />
<span>
{venueName || (
<span className="animate-pulse bg-white/20 rounded h-5 w-32 inline-block" />
)}
</span>
</div>
</div>
</div>
);
}