-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSchedule.tsx
More file actions
157 lines (142 loc) · 4.28 KB
/
Schedule.tsx
File metadata and controls
157 lines (142 loc) · 4.28 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import { FC, ReactNode } from 'react';
import { Container } from 'react-bootstrap';
import { TimeData } from 'web-utility';
import { TimeRange } from '../../TimeRange';
import type { HackathonAwardsMeta } from './Awards';
import styles from './Schedule.module.less';
export type HackathonScheduleTone =
| 'break'
| 'competition'
| 'enrollment'
| 'evaluation'
| 'formation';
export interface HackathonScheduleFact extends HackathonAwardsMeta {
meta: string;
}
export interface HackathonScheduleItem extends Record<
'id' | 'phase' | 'title' | 'description',
string
> {
facts: HackathonScheduleFact[];
endedAt?: TimeData;
startedAt?: TimeData;
stageGoal?: string;
tone: HackathonScheduleTone;
}
export interface HackathonScheduleProps extends Record<
'title' | 'subtitle' | 'lead' | 'kicker' | 'stageGoalLabel',
string
> {
items: HackathonScheduleItem[];
keyDates?: {
label: string;
startedAt?: TimeData;
endedAt?: TimeData;
}[];
overviewPills: ReactNode[];
}
const ScheduleCard: FC<HackathonScheduleItem & Record<'phaseLabel' | 'stageGoalLabel', string>> = ({
description,
endedAt,
facts,
phase,
phaseLabel,
startedAt,
stageGoal,
stageGoalLabel,
title,
tone,
}) => (
<article className={`${styles.dayCard} ${styles[tone]}`}>
<div
className={`${styles.dayCardHead} d-flex justify-content-between align-items-baseline gap-3`}
>
<span className={`${styles.dayNo} d-inline-flex align-items-center`}>
{phaseLabel} {phase}
</span>
<span className={styles.dayDate}>
<TimeRange start={startedAt} end={endedAt} />
</span>
</div>
<h3 className={`${styles.dayTitle} mt-3 mb-2`}>{title}</h3>
<p className={`${styles.daySub} mb-3`}>{description}</p>
<dl className={styles.dayAgenda}>
{facts.map(({ label, meta, value }) => (
<div key={`${label}-${value}`}>
<dt className={`${styles.timePill} d-inline-flex align-items-center`}>{label}</dt>
<dd className={`${styles.agendaCopy} d-flex flex-column gap-1`}>
<strong>{value}</strong>
<span>{meta}</span>
</dd>
</div>
))}
</dl>
{stageGoal && (
<p className={`${styles.stageGoal} d-flex flex-wrap gap-2 mt-3 pt-3`}>
<strong>{stageGoalLabel}:</strong>
<span>{stageGoal}</span>
</p>
)}
</article>
);
export const HackathonSchedule: FC<HackathonScheduleProps & { phaseLabel: string }> = ({
items,
keyDates,
kicker,
lead,
overviewPills,
phaseLabel,
stageGoalLabel,
subtitle,
title,
}) => (
<section id="schedule" className={styles.section}>
<Container>
<header className={styles.sectionHeader}>
<p className={`${styles.scheduleKicker} mb-1`}>{kicker}</p>
<h2 className={styles.sectionTitle}>{title}</h2>
<p className={styles.sectionSubtitle}>{subtitle}</p>
<div className={styles.accentLine} />
</header>
{lead && (
<hgroup className={`${styles.scheduleIntro} text-center mb-4`}>
<h3 className={styles.scheduleLead}>{lead}</h3>
</hgroup>
)}
<ul
className={`list-unstyled ${styles.scheduleOverview} d-flex flex-wrap justify-content-center gap-3 mb-4`}
>
{overviewPills.map((pill, index) => (
<li key={index} className={styles.schedulePill}>
{pill}
</li>
))}
</ul>
<div className={styles.scheduleDays}>
{items.map(item => (
<ScheduleCard
key={item.id}
{...item}
phaseLabel={phaseLabel}
stageGoalLabel={stageGoalLabel}
/>
))}
</div>
{keyDates?.[0] && (
<ul className={`list-unstyled ${styles.keyDates} mt-4`}>
{keyDates.map(({ startedAt, endedAt, label }, index) => (
<li
key={`${startedAt || ''}-${endedAt || ''}-${label}`}
className={`${styles.keyDateCard} d-grid gap-1 ${index % 2 ? styles.keyDateCardWarn : ''}`}
>
<strong className={styles.keyDateValue}>
<TimeRange start={startedAt} end={endedAt} format="MM-DD" />
</strong>
<span className={styles.keyDateLabel}>{label}</span>
</li>
))}
</ul>
)}
</Container>
</section>
);