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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
|
/* Adapted from https://codyhouse.co/gem/vertical-timeline/ with significant
* modifications.
* */
:root {
--side-spacing: 0;
--background-color: rgb(232, 239, 245);
--accent: hsl(205, 26%, 84%);
--timeline-line-color: hsl(205, 38%, 89%);
--timeline-line-width: 4px;
--timeline-line-half-width: calc(var(--timeline-line-width) / 2);
--content-background-color: white;
--content-padding: 1.25rem;
--icon-width: 60px;
--icon-half-width: calc(var(--icon-width) / 2);
--icon-border-width: 4px;
--icon-border-color: white;
--icon-color: white;
--icon-image-width: 40px;
--icon-size: 1.5rem;
--icon-side-spacing: 1.5rem;
--date-color: hsl(0, 0%, 48%);
--arrow-size: 7px;
}
[data-theme="dark"] {
--background-color: #2C2F33;
--content-background-color: #23272A;
--accent: hsl(0, 0%, 34%);
--timeline-line-color: var(--accent);
--icon-border-color: hsl(0, 0%, 50%);
}
@media (max-width: 1023px) {
:root {
--side-spacing: 1.25rem;
--icon-side-spacing: var(--side-spacing);
--icon-width: 40px;
--icon-image-width: 30px;
--icon-size: 1.1rem;
}
}
/* Use a tighter margin and smaller icon dimensions on the most narrow screens.
* */
@media (max-width: 600px) {
:root {
--side-spacing: .75rem;
--icon-side-spacing: .5rem;
--timeline-line-width: 3px;
--icon-width: 30px;
--icon-border-width: 3px;
--icon-image-width: 24px;
--icon-size: .9rem;
}
}
/* Containers */
.timeline {
overflow: hidden;
padding: 3rem 0;
background-color: var(--background-color);
}
.timeline .container {
position: relative;
padding: 1rem var(--side-spacing);
}
/* The line that goes through all the icons */
.timeline .container::before {
content: '';
position: absolute;
height: 100%;
width: var(--timeline-line-width);
background-color: var(--timeline-line-color);
z-index: 1;
}
@media (min-width: 1023px) {
.timeline .container::before {
left: calc(50% - var(--timeline-line-half-width));
}
}
@media (max-width: 1023px) {
.timeline .container::before {
margin-left: calc(var(--icon-half-width) - var(--timeline-line-half-width));
}
}
/* Each timeline item */
.timeline-item {
display: flex;
align-items: flex-start;
margin-bottom: 2.5rem;
}
/* Arrow indicator on the top left/right of each content box */
.timeline-content::before {
content: '';
position: absolute;
border: solid var(--arrow-size) transparent;
border-right-color: var(--accent);
height: 0;
}
@media (max-width: 1023px) {
.timeline-content::before {
margin-left: calc(0px - var(--content-padding) - 14px);
margin-top: calc(0px - var(--arrow-size) / 2);
}
}
@media (max-width: 600px) {
.timeline-content::before {
margin-top: calc(0px - var(--icon-half-width) + var(--arrow-size));
}
}
@media (min-width: 1023px) {
.timeline-content::before {
right: 100%;
margin-top: var(--arrow-size);
}
.timeline-item:nth-child(odd) .timeline-content::before {
border-left-color: var(--accent);
border-right-color: transparent;
left: 100%;
right: unset;
}
}
/* Visual container of the timeline item */
.timeline-content.box {
padding: var(--content-padding);
box-shadow: var(--accent) 0px 3px 0px 0px;
background-color: var(--content-background-color);
flex-grow: 1;
}
/* Don't make the titles show up as the link colors before hover. */
.timeline-content h3 a {
color: inherit;
}
.timeline-content h3 a:hover {
color: #7289DA;
}
@media (min-width: 1023px) {
.timeline-item:nth-child(odd) {
flex-direction: row-reverse;
}
/* On desktop, the content boxes are anchored with respect to the vertical
* center of the screen, set using `left`/`right` properties depending on
* even and odd children of timeline items.
* */
.timeline-content.box {
width: 45%;
flex-grow: 0;
position: relative;
--content-position: calc(50% + var(--icon-border-width) + var(--icon-half-width));
left: var(--content-position);
margin-left: var(--icon-side-spacing);
}
.timeline-item:nth-child(odd) .timeline-content.box {
left: unset;
right: var(--content-position);
margin-right: var(--icon-side-spacing);
}
}
@media (max-width: 1023px) {
.timeline-content.box {
margin-left: calc(var(--icon-side-spacing) + var(--arrow-size));
}
}
/* The icon and date components are grouped together in a flexbox to ensure
* there are center-aligned vertically on both desktop and mobile screens. This
* also makes it easy to both have dates' horizontal position follow that of
* the icon, and reverse their ordering for alternate timeline items on
* desktop.
* */
.timeline-icon-date {
z-index: 4;
display: flex;
align-items: baseline;
}
@media (min-width: 1023px) {
.timeline-icon-date {
order: 1;
/* Arbitrary container width to prevent wrapping of the date text */
width: 50%;
align-items: center;
gap: var(--icon-side-spacing);
position: absolute;
left: calc(50% - var(--icon-half-width));
}
.timeline-item:nth-child(even) .timeline-icon-date {
flex-direction: row-reverse;
left: unset;
right: calc(50% - var(--icon-half-width));
}
}
/* Icon */
.timeline-icon {
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
border-radius: 50%;
height: var(--icon-width);
width: var(--icon-width);
/* The border does not actually use the border property because this border
* needs to cover the bottom box-shadow, which is easier if the border is
* implemented as a box-shadow.
* */
box-shadow: 0 0 0 var(--icon-border-width) var(--icon-border-color),
inset 0 2px 0 rgba(0,0,0,.08),
0 3px 0 4px rgba(0,0,0,.05);
margin-top: var(--icon-border-width);
/* Font Awesome icon size and color */
color: var(--icon-color);
font-size: var(--icon-size);
}
/* Icons that use a custom image */
.timeline-icon img {
width: var(--icon-image-width);
height: var(--icon-image-width);
}
/* Icons that use the pydis logo */
.timeline-icon img.pydis {
/* Visually centering the pydis logo requires a margin adjustment here
* due to the right and bottom box shadow on the logo which is not very
* visible on the page.
*
* XXX: Hardcoded; Unresponsive to actual image dimensions.
* */
margin-top: 1px;
margin-left: 1px;
}
.timeline-date {
font-size: .9rem;
color: var(--date-color);
}
@media (min-width: 1023px) {
.timeline-item:nth-child(even) .timeline-date {
left: auto;
right: 50%;
text-align: right;
}
}
@media (max-width: 1023px) {
.timeline-date {
position: absolute;
/* On mobile, place the date at the top of the text box left-aligned
* with the other text in the box. When margin-left is zero, the date
* is left-aligned to the left of the icon (right of box-shadow).
* */
margin-left: calc(var(--icon-width) + var(--icon-side-spacing)
+ var(--arrow-size) + var(--content-padding));
margin-top: .75rem;
}
.timeline-content.content h3 {
/* Make space for the date text */
margin-top: 1.25rem;
}
}
/* Icon background colors */
.pastel-red {
background-color: #ff7878 !important;
}
[data-theme="dark"] .pastel-red {
background-color: #a44848 !important;
}
.pastel-orange {
background-color: #ffbf76 !important;
}
[data-theme="dark"] .pastel-orange {
background-color: #967147 !important;
}
.pastel-green {
background-color: #8bd6a7 !important;
}
[data-theme="dark"] .pastel-green {
background-color: #649f7a !important;
}
.pastel-blue {
background-color: #8edbec !important;
}
[data-theme="dark"] .pastel-blue {
background-color: #3d7986 !important;
}
.pastel-purple {
background-color: #cbb1ff !important;
}
[data-theme="dark"] .pastel-purple {
background-color: #8775ad !important;
}
.pastel-pink {
background-color: #f6acff !important;
}
[data-theme="dark"] .pastel-pink {
background-color: #79507e !important;
}
.pastel-lime {
background-color: #b6df3a !important;
}
[data-theme="dark"] .pastel-lime {
background-color: #7c9a21 !important;
}
.pastel-dark-blue {
/* Works well for both themes */
background-color: #576297 !important;
}
img, video, svg {
max-width: 100%
}
/* Bounce-in and bounce-out animations, desktop-only */
@media (min-width: 1023px) {
.timeline-icon--hidden, .timeline-content--hidden, .timeline-date--hidden {
visibility: hidden;
}
.timeline-icon--bounce-in {
animation: icon-bounce 0.6s;
}
.timeline-content--bounce-in,
.timeline-date--bounce-in {
animation: item-bounce-left 0.6s;
}
.timeline-item:nth-child(even) .timeline-content--bounce-in,
.timeline-item:nth-child(even) .timeline-date--bounce-in {
animation-name: item-bounce-right;
}
.timeline-icon--bounce-out {
animation: icon-bounce-out 0.6s;
}
.timeline-content--bounce-out,
.timeline-date--bounce-out {
animation: item-bounce-out 0.6s;
}
}
@keyframes icon-bounce {
0% {
opacity: 0;
transform: scale(0.5);
}
60% {
opacity: 1;
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
@keyframes item-bounce-left {
0% {
opacity: 0;
transform: translateX(-100px)
}
60% {
opacity: 1;
transform: translateX(20px)
}
100% {
transform: translateX(0)
}
}
@keyframes item-bounce-right {
0% {
opacity: 0;
transform: translateX(100px)
}
60% {
opacity: 1;
transform: translateX(-20px)
}
100% {
transform: translateX(0)
}
}
@keyframes icon-bounce-out {
0% {
opacity: 1;
transform: scale(1);
}
60% {
transform: scale(1.2);
}
100% {
opacity: 0;
transform: scale(0.5);
}
}
@keyframes item-bounce-out {
0% {
opacity: 1;
transform: translateX(0);
}
60% {
transform: translateX(20px);
}
100% {
opacity: 0;
transform: translateX(-100px);
}
}
|