Skip to content

Commit b274b98

Browse files
authored
Update developer menu layout (#543)
- Use gridlayout to avoid fixd settings panel height and better adjust to window height - Indent settings without chekcbox - Better style select elements - Use consistent spacing around checkbox in settings and suite selection
1 parent 3175f48 commit b274b98

2 files changed

Lines changed: 58 additions & 13 deletions

File tree

resources/developer-mode.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function createCheckboxUI(labelValue, initialValue, paramsUpdateCallback) {
7272
};
7373

7474
const label = document.createElement("label");
75-
label.append(checkbox, " ", span(labelValue));
75+
label.append(checkbox, span(labelValue));
7676

7777
return label;
7878
}

resources/main.css

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
--text-width: 650px;
1111
--metrics-line-height: 25px;
1212
--scrollbar-width: 10px;
13-
--developer-mode-settings-height: 280px;
1413
}
1514

1615
body {
@@ -226,24 +225,41 @@ button,
226225
position: fixed;
227226
left: 10px;
228227
top: 10px;
228+
max-height: calc(100vh - 20px);
229+
display: grid;
230+
grid-template-rows: minmax(0, 1fr);
231+
box-sizing: border-box;
232+
}
233+
234+
.developer-mode details {
235+
display: grid;
236+
grid-template-rows: min-content minmax(0, 1fr);
237+
min-height: 0;
229238
}
230239

231240
.developer-mode summary {
232241
user-select: none;
242+
font-size: 20px;
233243
cursor: pointer;
234244
padding: 1rem;
235245
margin: -1rem -1rem 0 -1rem;
236246
}
237247

238248
.developer-mode-content {
249+
display: flex;
250+
flex-direction: column;
251+
height: 100%;
252+
min-height: 0;
239253
padding-bottom: 1rem;
254+
box-sizing: border-box;
240255
}
241256

242257
.developer-mode .suites {
243-
max-height: calc(100vh - var(--developer-mode-settings-height));
258+
flex: 0 1 auto;
259+
min-height: 0;
244260
margin-right: calc(0px - var(--scrollbar-width));
245261
padding-right: var(--scrollbar-width);
246-
overflow: auto;
262+
overflow-y: auto;
247263
}
248264

249265
.developer-mode-content ol {
@@ -253,6 +269,7 @@ button,
253269
}
254270
.developer-mode-content .button-bar {
255271
display: flex;
272+
flex: none;
256273
margin-top: 5px;
257274
gap: 3px;
258275
}
@@ -265,20 +282,47 @@ button,
265282
content: " ✘";
266283
}
267284

285+
.developer-mode-content .settings {
286+
flex: none;
287+
display: grid;
288+
/* Col 1: checkbox, Col 2: text, Col 3: input, Col 4: value */
289+
grid-template-columns: min-content 1fr 1fr 5em;
290+
align-items: center;
291+
gap: 4px;
292+
}
293+
.developer-mode-content .settings hr {
294+
grid-column: 1 / -1;
295+
margin: 8px 0;
296+
}
297+
268298
.developer-mode-content .settings label {
269-
width: 100%;
270-
display: flex;
299+
display: contents;
300+
}
301+
.developer-mode-content .settings label > span:first-child {
302+
/* Range and Select labels start here */
303+
grid-column: 2;
304+
}
305+
.developer-mode-content .settings label:not(:has(input[type="checkbox"]))::before {
306+
content: "•";
307+
grid-column: 1;
308+
margin-right: 0.2em; /* match checkbox margin so it visually centers */
309+
place-self: center;
310+
color: var(--foreground);
311+
}
312+
.developer-mode-content input[type="checkbox"] {
313+
grid-column: 1;
314+
margin: 0 0.2em 0 0;
271315
}
272-
.developer-mode-content .settings label * {
273-
flex: 1;
316+
.developer-mode-content .settings input[type="checkbox"] + span {
317+
/* Checkbox text spans the rest of the row */
318+
grid-column: 2 / -1;
274319
}
275-
.developer-mode-content .settings input[type="checkbox"] {
276-
flex: 0;
277-
margin-left: 0px;
320+
.developer-mode-content .settings select {
321+
/* Select spans input and value columns */
322+
grid-column: 3 / -1;
278323
}
279324
.developer-mode-content .settings .range-label-data {
280-
flex: 0;
281-
min-width: 5em;
325+
grid-column: 4;
282326
text-align: right;
283327
}
284328

@@ -313,6 +357,7 @@ button,
313357
background: rgba(255, 255, 255, 0.1);
314358
}
315359
.developer-mode-content hr {
360+
flex: none;
316361
width: initial;
317362
margin: 10px 0;
318363
}

0 commit comments

Comments
 (0)