forge
Explore
Log in

Don't you dare go Hollow

iz

Clone
★ 0

0 watching0 forksRustAGPL-3.0567.3 KiB3950aceTahinli27 days ago34 commits

_components.scss358 lines, 7.3 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.warning {
150 padding: var(--space-3) var(--space-4);
151 border-radius: var(--radius-sm);
152 border: 1px solid transparent;
153}
154
155.alert {
156 background: var(--danger-soft);
157 color: var(--danger);
158 border-color: var(--danger);
159}
160
161// A condition the admin should look at, not a failure of the request.
162.warning {
163 background: var(--warn-soft);
164 color: var(--warn);
165 border-color: var(--warn);
166}
167
168.notice {
169 background: var(--accent-soft);
170 color: var(--text);
171 border-color: var(--accent-soft);
172}
173
174// --- Tables and badges ------------------------------------------------------------------------
175
176.table-wrap {
177 overflow-x: auto;
178 border: 1px solid var(--border);
179 border-radius: var(--radius);
180 background: var(--surface);
181}
182
183.table {
184 width: 100%;
185 border-collapse: collapse;
186 font-size: var(--text-sm);
187}
188
189.table th,
190.table td {
191 padding: var(--space-2) var(--space-3);
192 text-align: left;
193 border-bottom: 1px solid var(--border);
194 vertical-align: top;
195}
196
197.table th {
198 color: var(--muted);
199 font-weight: 600;
200 background: var(--surface-2);
201}
202
203.table tr:last-child td {
204 border-bottom: 0;
205}
206
207.badge {
208 display: inline-block;
209 padding: 0.1rem var(--space-2);
210 border-radius: 999px;
211 background: var(--surface-2);
212 color: var(--muted);
213 font-size: 0.8rem;
214 font-weight: 600;
215 white-space: nowrap;
216}
217
218.badge.accent {
219 background: var(--accent-soft);
220 color: var(--accent-strong);
221}
222
223// --- Empty state and the 404 page -------------------------------------------------------------
224
225.empty-state {
226 display: grid;
227 justify-items: center;
228 gap: var(--space-3);
229 padding: var(--space-8) var(--space-6);
230 text-align: center;
231 color: var(--muted);
232 border: 1px dashed var(--border);
233 border-radius: var(--radius);
234}
235
236.empty-state h2 {
237 margin: 0;
238 color: var(--text);
239}
240
241.empty-state p {
242 margin: 0;
243 max-width: 34rem;
244}
245
246.not-found {
247 text-align: center;
248 padding-block: var(--space-8);
249}
250
251.not-found-code {
252 margin: 0;
253 font-size: 3.5rem;
254 font-weight: 700;
255 letter-spacing: -0.03em;
256 color: var(--accent);
257 line-height: 1;
258}
259
260// --- Server restarting bar --------------------------------------------------------------------
261
262// Pinned to the bottom edge. nav.js creates it only while the server is unreachable, so a page
263// that never loses the server never shows it.
264.restart-bar {
265 position: fixed;
266 left: 50%;
267 bottom: var(--space-4);
268 z-index: 50;
269 transform: translateX(-50%);
270 display: flex;
271 align-items: center;
272 gap: var(--space-3);
273 max-width: calc(100vw - 2 * var(--space-4));
274 padding: var(--space-2) var(--space-4);
275 border-radius: 999px;
276 background: var(--warn-soft);
277 color: var(--warn);
278 border: 1px solid var(--warn);
279 box-shadow: var(--shadow-lift);
280 font-size: var(--text-sm);
281 font-weight: 550;
282 animation: restart-in 180ms ease-out;
283}
284
285.restart-bar::before {
286 content: "";
287 width: 0.55rem;
288 height: 0.55rem;
289 border-radius: 50%;
290 background: currentColor;
291 animation: restart-pulse 1.2s ease-in-out infinite;
292}
293
294@keyframes restart-in {
295 from {
296 opacity: 0;
297 transform: translate(-50%, 0.5rem);
298 }
299}
300
301@keyframes restart-pulse {
302 50% {
303 opacity: 0.25;
304 }
305}
306
307// While the page is loading a soft navigation or a refresh, its content dims a little.
308.is-loading main {
309 opacity: 0.6;
310 transition: opacity 120ms ease;
311}
312
313@media (prefers-reduced-motion: reduce) {
314 .restart-bar,
315 .restart-bar::before {
316 animation: none;
317 }
318
319 .is-loading main,
320 .button {
321 transition: none;
322 }
323}
324
325// Admin pages: tables of projects, columns and members; name and value lists; inline forms; the colour swatch.
326.admin-table {
327 width: 100%;
328 border-collapse: collapse;
329 td, th { padding: 0.4rem 0.5rem; vertical-align: middle; text-align: start; }
330}
331.inline {
332 display: inline-flex;
333 flex-wrap: wrap;
334 gap: 0.4rem;
335 align-items: center;
336}
337.facts {
338 display: grid;
339 grid-template-columns: max-content 1fr;
340 gap: 0.3rem 1rem;
341 dt { color: var(--muted); }
342 dd { margin: 0; }
343}
344.tone-dot {
345 display: inline-block;
346 width: 0.75em;
347 height: 0.75em;
348 border-radius: 50%;
349 background: var(--muted);
350 &[data-colour="c0"] { background: #c2d0ff; }
351 &[data-colour="c1"] { background: #9fe0b4; }
352 &[data-colour="c2"] { background: #f2c265; }
353 &[data-colour="c3"] { background: #f5a3a3; }
354 &[data-colour="c4"] { background: #a8d8f0; }
355 &[data-colour="c5"] { background: #d7b3f0; }
356 &[data-colour="c6"] { background: #ffd1a6; }
357 &[data-colour="c7"] { background: #c9d6c2; }
358}