forge
Explore
Log in

Don't you dare go Hollow

im

Clone
★ 0

0 watching0 forksRustAGPL-3.0542.8 KiBb9f0726Tahinli27 days ago34 commits

_components.scss510 lines, 9.1 KiBHistoryRawDownload
1//! Components: buttons, form controls, cards, alerts, tables, badges, the empty state, the 404 page
2//! and the "server restarting" bar. Each is one class (or one element) with its states.
3
4// --- Buttons -----------------------------------------------------------------------------------
5
6.button {
7 display: inline-flex;
8 align-items: center;
9 justify-content: center;
10 gap: var(--space-2);
11 min-height: 2.25rem;
12 padding: var(--space-2) var(--space-4);
13 border: 1px solid var(--border);
14 border-radius: var(--radius-sm);
15 background: var(--surface);
16 color: var(--text);
17 font: inherit;
18 font-weight: 550;
19 text-decoration: none;
20 cursor: pointer;
21 box-shadow: var(--shadow);
22 transition: background-color 120ms ease, border-color 120ms ease;
23}
24
25.button:hover {
26 background: var(--surface-2);
27 color: var(--text);
28}
29
30.button:disabled,
31.button[aria-disabled="true"] {
32 opacity: 0.55;
33 cursor: not-allowed;
34}
35
36.button.primary {
37 background: var(--accent);
38 border-color: var(--accent);
39 color: var(--accent-text);
40}
41
42.button.primary:hover {
43 background: var(--accent-strong);
44 border-color: var(--accent-strong);
45 color: var(--accent-text);
46}
47
48.button.danger {
49 color: var(--danger);
50 border-color: var(--danger);
51}
52
53.button.ghost {
54 background: transparent;
55 box-shadow: none;
56 border-color: transparent;
57}
58
59// --- Form controls ----------------------------------------------------------------------------
60
61label {
62 display: block;
63 font-weight: 550;
64 font-size: var(--text-sm);
65 margin-bottom: var(--space-1);
66}
67
68input:not([type="checkbox"]):not([type="radio"]),
69select,
70textarea {
71 width: 100%;
72 min-height: 2.25rem;
73 padding: var(--space-2) var(--space-3);
74 border: 1px solid var(--border);
75 border-radius: var(--radius-sm);
76 background: var(--surface);
77 color: var(--text);
78 font: inherit;
79}
80
81textarea {
82 min-height: 6rem;
83 resize: vertical;
84}
85
86input:focus,
87select:focus,
88textarea:focus {
89 outline: 2px solid var(--focus);
90 outline-offset: 0;
91 border-color: transparent;
92}
93
94input::placeholder,
95textarea::placeholder {
96 color: var(--muted);
97 opacity: 0.8;
98}
99
100.field {
101 display: grid;
102 gap: var(--space-1);
103}
104
105.field + .field {
106 margin-top: var(--space-4);
107}
108
109.field-hint {
110 color: var(--muted);
111 font-size: var(--text-sm);
112}
113
114// --- Cards and text ---------------------------------------------------------------------------
115
116.card {
117 padding: var(--space-6);
118 background: var(--surface);
119 border: 1px solid var(--border);
120 border-radius: var(--radius);
121 box-shadow: var(--shadow);
122}
123
124.card > :last-child {
125 margin-bottom: 0;
126}
127
128.card-title {
129 margin-bottom: var(--space-2);
130}
131
132.muted {
133 color: var(--muted);
134}
135
136.kicker {
137 margin-bottom: var(--space-2);
138 color: var(--muted);
139 font-size: var(--text-sm);
140 font-weight: 600;
141 letter-spacing: 0.04em;
142 text-transform: uppercase;
143}
144
145// --- Alerts -----------------------------------------------------------------------------------
146
147.alert,
148.notice {
149 padding: var(--space-3) var(--space-4);
150 border-radius: var(--radius-sm);
151 border: 1px solid transparent;
152}
153
154.alert {
155 background: var(--danger-soft);
156 color: var(--danger);
157 border-color: var(--danger);
158}
159
160.notice {
161 background: var(--accent-soft);
162 color: var(--text);
163 border-color: var(--accent-soft);
164}
165
166// --- Tables and badges ------------------------------------------------------------------------
167
168.table-wrap {
169 overflow-x: auto;
170 border: 1px solid var(--border);
171 border-radius: var(--radius);
172 background: var(--surface);
173}
174
175.table {
176 width: 100%;
177 border-collapse: collapse;
178 font-size: var(--text-sm);
179}
180
181.table th,
182.table td {
183 padding: var(--space-2) var(--space-3);
184 text-align: left;
185 border-bottom: 1px solid var(--border);
186 vertical-align: top;
187}
188
189.table th {
190 color: var(--muted);
191 font-weight: 600;
192 background: var(--surface-2);
193}
194
195.table tr:last-child td {
196 border-bottom: 0;
197}
198
199.badge {
200 display: inline-block;
201 padding: 0.1rem var(--space-2);
202 border-radius: 999px;
203 background: var(--surface-2);
204 color: var(--muted);
205 font-size: 0.8rem;
206 font-weight: 600;
207 white-space: nowrap;
208}
209
210.badge.accent {
211 background: var(--accent-soft);
212 color: var(--accent-strong);
213}
214
215// --- Empty state and the 404 page -------------------------------------------------------------
216
217.empty-state {
218 display: grid;
219 justify-items: center;
220 gap: var(--space-3);
221 padding: var(--space-8) var(--space-6);
222 text-align: center;
223 color: var(--muted);
224 border: 1px dashed var(--border);
225 border-radius: var(--radius);
226}
227
228.empty-state h2 {
229 margin: 0;
230 color: var(--text);
231}
232
233.empty-state p {
234 margin: 0;
235 max-width: 34rem;
236}
237
238.not-found {
239 text-align: center;
240 padding-block: var(--space-8);
241}
242
243.not-found-code {
244 margin: 0;
245 font-size: 3.5rem;
246 font-weight: 700;
247 letter-spacing: -0.03em;
248 color: var(--accent);
249 line-height: 1;
250}
251
252// --- Server restarting bar --------------------------------------------------------------------
253
254// Pinned to the bottom edge. nav.js creates it only while the server is unreachable, so a page
255// that never loses the server never shows it.
256.restart-bar {
257 position: fixed;
258 left: 50%;
259 bottom: var(--space-4);
260 z-index: 50;
261 transform: translateX(-50%);
262 display: flex;
263 align-items: center;
264 gap: var(--space-3);
265 max-width: calc(100vw - 2 * var(--space-4));
266 padding: var(--space-2) var(--space-4);
267 border-radius: 999px;
268 background: var(--warn-soft);
269 color: var(--warn);
270 border: 1px solid var(--warn);
271 box-shadow: var(--shadow-lift);
272 font-size: var(--text-sm);
273 font-weight: 550;
274 animation: restart-in 180ms ease-out;
275}
276
277.restart-bar::before {
278 content: "";
279 width: 0.55rem;
280 height: 0.55rem;
281 border-radius: 50%;
282 background: currentColor;
283 animation: restart-pulse 1.2s ease-in-out infinite;
284}
285
286@keyframes restart-in {
287 from {
288 opacity: 0;
289 transform: translate(-50%, 0.5rem);
290 }
291}
292
293@keyframes restart-pulse {
294 50% {
295 opacity: 0.25;
296 }
297}
298
299// While the page is loading a soft navigation or a refresh, its content dims a little.
300.is-loading main {
301 opacity: 0.6;
302 transition: opacity 120ms ease;
303}
304
305@media (prefers-reduced-motion: reduce) {
306 .restart-bar,
307 .restart-bar::before {
308 animation: none;
309 }
310
311 .is-loading main,
312 .button {
313 transition: none;
314 }
315}
316
317// Account pages: the forms, the item lists of the sessions page, the security codes and the
318// account menu of the topbar. The views only use these class names; nothing here is inline.
319
320.stack {
321 display: grid;
322 gap: 0.9rem;
323}
324
325.narrow {
326 max-width: 28rem;
327 width: 100%;
328 margin-inline: auto;
329}
330
331.hint {
332 color: var(--muted);
333 font-size: 0.875rem;
334 margin: 0;
335}
336
337.warning {
338 color: var(--warn);
339 background: var(--warn-soft);
340 border-radius: var(--radius);
341 padding: 0.6rem 0.8rem;
342 margin: 0;
343}
344
345.facts {
346 display: grid;
347 grid-template-columns: max-content 1fr;
348 gap: 0.4rem 1.2rem;
349 margin: 0;
350
351 dt {
352 color: var(--muted);
353 }
354
355 dd {
356 margin: 0;
357 }
358}
359
360.links {
361 display: flex;
362 flex-wrap: wrap;
363 gap: 0.4rem 1rem;
364}
365
366.qr {
367 width: 240px;
368 height: 240px;
369 max-width: 100%;
370 background: #fff;
371 border-radius: var(--radius);
372 padding: 0.5rem;
373}
374
375.secret,
376.codes-list code {
377 font-family: var(--font-mono);
378 overflow-wrap: anywhere;
379}
380
381.codes-list {
382 list-style: none;
383 padding: 0;
384 margin: 0;
385 display: grid;
386 grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
387 gap: 0.4rem;
388
389 code {
390 display: block;
391 background: var(--surface-2);
392 border-radius: var(--radius);
393 padding: 0.4rem 0.6rem;
394 font-size: 1.05rem;
395 }
396}
397
398.item-list {
399 list-style: none;
400 padding: 0;
401 margin: 0;
402 display: grid;
403 gap: 0.6rem;
404}
405
406.item {
407 display: flex;
408 flex-wrap: wrap;
409 align-items: center;
410 justify-content: space-between;
411 gap: 0.6rem 1rem;
412 background: var(--surface);
413 border: 1px solid var(--border);
414 border-radius: var(--radius);
415 padding: 0.8rem 1rem;
416}
417
418.item-main {
419 display: grid;
420 gap: 0.2rem;
421 min-width: 0;
422}
423
424.item-action {
425 margin: 0;
426}
427
428.user-menu {
429 position: relative;
430
431 summary {
432 cursor: pointer;
433 list-style: none;
434 display: inline-flex;
435 align-items: center;
436 gap: 0.4rem;
437 padding: 0.3rem 0.5rem;
438 border-radius: var(--radius);
439 }
440
441 summary::-webkit-details-marker {
442 display: none;
443 }
444
445 &[open] > summary {
446 background: var(--surface-2);
447 }
448}
449
450.user-menu-name {
451 font-weight: 600;
452}
453
454.user-menu-panel {
455 position: absolute;
456 right: 0;
457 top: 100%;
458 margin-top: 0.3rem;
459 min-width: 12rem;
460 z-index: 10;
461 display: grid;
462 gap: 0.3rem;
463 padding: 0.3rem;
464 background: var(--surface);
465 border: 1px solid var(--border);
466 border-radius: var(--radius);
467 box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
468}
469
470.user-menu-links {
471 display: grid;
472
473 a {
474 padding: 0.4rem 0.6rem;
475 border-radius: 6px;
476 color: var(--text);
477 text-decoration: none;
478 }
479
480 a:hover {
481 background: var(--surface-2);
482 }
483}
484
485.user-menu-logout {
486 margin: 0;
487}
488
489/* Profile photos. The picture is always square; the initials image is served the same way. */
490.avatar {
491 width: 4rem;
492 height: 4rem;
493 border-radius: 50%;
494 object-fit: cover;
495 flex: none;
496}
497
498.avatar-large {
499 width: 8rem;
500 height: 8rem;
501 border-radius: 50%;
502 object-fit: cover;
503}
504
505.profile-photo {
506 display: flex;
507 align-items: center;
508 gap: var(--space-4);
509 flex-wrap: wrap;
510}