Skip to content

Commit a67b3a2

Browse files
feat(ui): align button styles, toolbar tokens, and nav drawer with learn-dvc
1 parent 397c979 commit a67b3a2

2 files changed

Lines changed: 78 additions & 48 deletions

File tree

‎src/style.css‎

Lines changed: 73 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
--coral: #f07070;
1414
--paper: #f3ede3;
1515
--paper-ink: #1a1f22;
16-
--line: #2a353b;
16+
--line: #2e3d4d;
1717

1818
/* shell aliases (learn-r structure uses these names) */
19-
--haze: var(--muted);
19+
--haze: #8fa0b2;
2020
--text: var(--ink);
21-
--panel-2: var(--raised);
22-
--dvc: var(--amber);
23-
--code: var(--amber);
21+
--panel-2: #22303c;
22+
--dvc: #3776ab;
23+
--code: #60a5fa;
2424
--ok: var(--teal);
2525
--warn: var(--amber);
2626
--err: var(--coral);
@@ -171,18 +171,14 @@ body {
171171
.nav-bars::after { top: 6px; }
172172

173173
.nav-drawer {
174-
display: contents !important;
175-
}
176-
177-
.nav-drawer button {
178-
min-height: 40px;
174+
display: contents;
179175
}
180176

181177
.help-btn {
182-
width: 40px;
183-
height: 40px;
184-
min-width: 40px;
185-
min-height: 40px;
178+
width: 36px;
179+
height: 36px;
180+
min-width: 36px;
181+
min-height: 36px;
186182
padding: 0;
187183
border: 1px solid var(--line);
188184
border-radius: 8px;
@@ -207,8 +203,8 @@ body {
207203
display: inline-flex;
208204
align-items: center;
209205
gap: 6px;
210-
min-height: 40px;
211-
padding: 8px 12px;
206+
min-height: 36px;
207+
padding: 7px 12px;
212208
border-radius: 8px;
213209
border: 1px solid var(--line);
214210
background: transparent;
@@ -225,26 +221,31 @@ body {
225221
text-decoration: none;
226222
}
227223

224+
.tb-link:focus-visible {
225+
outline: 2px solid var(--code);
226+
outline-offset: 2px;
227+
}
228+
228229
.tb-stat {
229230
display: inline-flex;
230231
align-items: center;
231232
gap: 6px;
232-
min-height: 40px;
233-
padding: 8px 12px;
233+
min-height: 36px;
234+
padding: 6px 10px;
234235
border-radius: 8px;
235-
border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
236+
border: 1px solid color-mix(in srgb, var(--dvc) 35%, var(--line));
236237
background: color-mix(in srgb, var(--panel-2) 65%, transparent);
237-
color: color-mix(in srgb, var(--text) 90%, var(--amber));
238+
color: color-mix(in srgb, var(--text) 90%, var(--dvc));
238239
font-family: var(--mono);
239240
font-size: 13px;
240-
font-weight: 500;
241-
letter-spacing: 0.02em;
241+
font-weight: 600;
242+
letter-spacing: 0.04em;
242243
box-sizing: border-box;
243244
user-select: none;
244245
}
245246

246247
.tb-stat .visitor-icon {
247-
color: var(--amber);
248+
color: var(--dvc);
248249
flex-shrink: 0;
249250
}
250251

@@ -254,15 +255,20 @@ body {
254255

255256
.tb-link.support {
256257
color: #ffe6b0;
257-
border-color: color-mix(in srgb, var(--amber) 55%, var(--line));
258-
background: color-mix(in srgb, var(--amber) 14%, var(--panel-2));
258+
border-color: color-mix(in srgb, var(--remote) 55%, var(--line));
259+
background: color-mix(in srgb, var(--remote) 14%, var(--panel-2));
260+
}
261+
262+
.tb-link.support:hover {
263+
background: color-mix(in srgb, var(--remote) 24%, var(--panel-2));
259264
}
260265

261266
.tb-link.gh {
262267
gap: 0;
263268
justify-content: center;
264-
width: 40px;
265-
min-width: 40px;
269+
width: 36px;
270+
min-width: 36px;
271+
height: 36px;
266272
padding: 0;
267273
}
268274

@@ -275,7 +281,7 @@ button,
275281
.btn {
276282
appearance: none;
277283
border: 1px solid var(--line);
278-
background: var(--raised);
284+
background: var(--panel-2);
279285
color: var(--text);
280286
border-radius: 8px;
281287
padding: 7px 12px;
@@ -288,21 +294,27 @@ button,
288294

289295
button:hover,
290296
.btn:hover {
291-
border-color: var(--amber);
292-
color: var(--amber);
293-
background: #222c32;
297+
border-color: var(--haze);
298+
color: var(--text);
299+
background: #2a3a4a;
294300
}
295301

296302
button:focus-visible,
297303
.btn:focus-visible {
298-
outline: 2px solid var(--amber);
304+
outline: 2px solid var(--code);
299305
outline-offset: 2px;
300306
}
301307

308+
button:disabled,
309+
.btn:disabled {
310+
opacity: 0.45;
311+
cursor: not-allowed;
312+
}
313+
302314
button.primary,
303315
.btn.primary {
304-
background: color-mix(in srgb, var(--amber) 28%, var(--panel-2));
305-
border-color: color-mix(in srgb, var(--amber) 55%, var(--line));
316+
background: color-mix(in srgb, var(--dvc) 35%, var(--panel-2));
317+
border-color: color-mix(in srgb, var(--dvc) 55%, var(--line));
306318
color: var(--text);
307319
}
308320

@@ -316,6 +328,12 @@ button.ghost,
316328
background: transparent;
317329
}
318330

331+
.btn-sm {
332+
min-height: 28px;
333+
padding: 4px 10px;
334+
font-size: 12px;
335+
}
336+
319337
/* —— Board area (Memory / Plot tabs) —— */
320338
.board-wrap {
321339
display: flex;
@@ -1318,7 +1336,7 @@ button.ghost,
13181336
}
13191337

13201338
.nav-drawer {
1321-
display: none !important;
1339+
display: none;
13221340
position: absolute;
13231341
top: calc(100% + 6px);
13241342
inset-inline-end: 0;
@@ -1335,11 +1353,30 @@ button.ghost,
13351353
}
13361354

13371355
.nav-drawer.is-open {
1356+
display: flex;
1357+
}
1358+
1359+
.nav-drawer[hidden] {
1360+
display: none !important;
1361+
}
1362+
1363+
.nav-drawer.is-open[hidden] {
13381364
display: flex !important;
13391365
}
13401366

1341-
.nav-drawer button {
1367+
.nav-drawer button,
1368+
.nav-drawer .tb-link {
13421369
width: 100%;
1370+
justify-content: flex-start;
1371+
min-height: 44px;
1372+
}
1373+
1374+
.modal-actions {
1375+
flex-wrap: wrap;
1376+
}
1377+
1378+
.modal-actions button {
1379+
flex: 1 1 auto;
13431380
min-height: 44px;
13441381
}
13451382

‎src/ui/app.ts‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class App {
162162
<button type="button" class="nav-toggle" data-action="nav-toggle" aria-label="Menu" aria-expanded="false" aria-controls="nav-drawer">
163163
<span class="nav-bars" aria-hidden="true"></span>
164164
</button>
165-
<div class="nav-drawer" id="nav-drawer">
165+
<div class="nav-drawer" id="nav-drawer" hidden>
166166
<button type="button" data-action="levels">Levels</button>
167167
<button type="button" data-action="lesson">Lesson</button>
168168
<button type="button" data-action="goal">Guide</button>
@@ -260,24 +260,17 @@ export class App {
260260
const drawer = this.root.querySelector<HTMLElement>('#nav-drawer');
261261
const btn = this.root.querySelector<HTMLButtonElement>('[data-action="nav-toggle"]');
262262
if (!drawer || !btn) return;
263-
const open = drawer.hasAttribute('hidden');
264-
if (open) {
265-
drawer.removeAttribute('hidden');
266-
drawer.classList.add('is-open');
267-
btn.setAttribute('aria-expanded', 'true');
268-
} else {
269-
drawer.setAttribute('hidden', '');
270-
drawer.classList.remove('is-open');
271-
btn.setAttribute('aria-expanded', 'false');
272-
}
263+
const open = drawer.classList.toggle('is-open');
264+
drawer.hidden = !open;
265+
btn.setAttribute('aria-expanded', String(open));
273266
}
274267

275268
private closeNav(): void {
276269
const drawer = this.root.querySelector<HTMLElement>('#nav-drawer');
277270
const btn = this.root.querySelector<HTMLButtonElement>('[data-action="nav-toggle"]');
278271
if (!drawer || !btn) return;
279-
drawer.setAttribute('hidden', '');
280272
drawer.classList.remove('is-open');
273+
drawer.hidden = true;
281274
btn.setAttribute('aria-expanded', 'false');
282275
}
283276

0 commit comments

Comments
 (0)