Skip to content

Commit bb4a4ad

Browse files
authored
Improve developerMode styling (#436)
- Maintain the same margin to the "Developer Mode" text when closed and open - Remove display flex that had no effect - Make sure the run settings are always visible - Scroll only the suites part - Move the select all / unselect all buttons to the top for better usability
1 parent 2a4d041 commit bb4a4ad

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

resources/developer-mode.mjs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,15 @@ function createTimeRangeUI(labelText, initialValue, unit = "ms", min = 0, max =
128128
function createUIForSuites() {
129129
const control = document.createElement("nav");
130130
control.className = "suites";
131-
const ol = document.createElement("ol");
132131
const checkboxes = [];
133132
const setSuiteEnabled = (suiteIndex, enabled) => {
134133
Suites[suiteIndex].disabled = !enabled;
135134
checkboxes[suiteIndex].checked = enabled;
136135
};
137136

137+
control.appendChild(createSuitesGlobalSelectButtons(setSuiteEnabled));
138+
139+
const ol = document.createElement("ol");
138140
for (const suite of Suites) {
139141
const li = document.createElement("li");
140142
const checkbox = document.createElement("input");
@@ -164,7 +166,12 @@ function createUIForSuites() {
164166
ol.appendChild(li);
165167
}
166168
control.appendChild(ol);
167-
let buttons = control.appendChild(document.createElement("div"));
169+
control.appendChild(createSuitesTagsButton(setSuiteEnabled));
170+
return control;
171+
}
172+
173+
function createSuitesGlobalSelectButtons(setSuiteEnabled) {
174+
const buttons = document.createElement("div");
168175
buttons.className = "button-bar";
169176

170177
let button = document.createElement("button");
@@ -186,18 +193,24 @@ function createUIForSuites() {
186193
updateURL();
187194
};
188195
buttons.appendChild(button);
196+
return buttons;
197+
}
189198

199+
function createSuitesTagsButton(setSuiteEnabled) {
200+
let tags = document.createElement("div");
201+
let buttons = tags.appendChild(document.createElement("div"));
202+
buttons.className = "button-bar";
190203
let i = 0;
191204
const kTagsPerLine = 3;
192205
for (const tag of Tags) {
193206
if (tag === "all")
194207
continue;
195208
if (!(i % kTagsPerLine)) {
196-
buttons = control.appendChild(document.createElement("div"));
209+
buttons = tags.appendChild(document.createElement("div"));
197210
buttons.className = "button-bar";
198211
}
199212
i++;
200-
button = document.createElement("button");
213+
const button = document.createElement("button");
201214
button.className = "tag";
202215
button.textContent = `#${tag}`;
203216
button.dataTag = tag;
@@ -217,8 +230,7 @@ function createUIForSuites() {
217230
};
218231
buttons.appendChild(button);
219232
}
220-
221-
return control;
233+
return tags;
222234
}
223235

224236
function createUIForRun() {

resources/main.css

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

1516
body {
@@ -213,35 +214,36 @@ button,
213214

214215
.developer-mode {
215216
border-radius: 10px;
216-
padding: 1rem;
217+
padding: 1rem 1rem 0 1rem;
217218
background: #602525;
218219
border: 3px solid rgba(255, 255, 255, 0.5);
219220
position: fixed;
220221
left: 10px;
221222
top: 10px;
222-
display: flex;
223-
flex-direction: column;
224223
}
225224

226225
.developer-mode summary {
227226
user-select: none;
228227
cursor: pointer;
229228
padding: 1rem;
230-
margin: -1rem;
229+
margin: -1rem -1rem 0 -1rem;
231230
}
232231

233232
.developer-mode-content {
234-
flex: 1;
235-
max-height: 80vh;
236-
overflow: auto;
233+
padding-bottom: 1rem;
234+
}
235+
236+
.developer-mode .suites {
237+
max-height: calc(100vh - var(--developer-mode-settings-height));
237238
margin-right: calc(0px - var(--scrollbar-width));
238239
padding-right: var(--scrollbar-width);
240+
overflow: auto;
239241
}
240242

241243
.developer-mode-content ol {
242244
list-style: none;
243245
padding: 0;
244-
margin: 1em 0 0.5em 0;
246+
margin: 0.5em 0 0 0;
245247
}
246248
.developer-mode-content .button-bar {
247249
display: flex;

0 commit comments

Comments
 (0)