Skip to content

Commit b48d649

Browse files
committed
Change toggle to checkbox with checkmark
1 parent 88effce commit b48d649

File tree

2 files changed

+29
-47
lines changed

2 files changed

+29
-47
lines changed

docs/app/index.html

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -325,49 +325,39 @@
325325
border-radius: 3px;
326326
}
327327

328-
/* Toggle */
329-
.toggle {
330-
position: relative;
331-
width: 40px;
332-
height: 22px;
333-
}
334-
335-
.toggle input {
336-
opacity: 0;
337-
width: 0;
338-
height: 0;
339-
}
340-
341-
.toggle-slider {
342-
position: absolute;
343-
cursor: pointer;
344-
top: 0;
345-
left: 0;
346-
right: 0;
347-
bottom: 0;
328+
/* Checkbox */
329+
.checkbox {
330+
width: 20px;
331+
height: 20px;
332+
appearance: none;
333+
-webkit-appearance: none;
348334
background: var(--bg-light);
349-
border-radius: 22px;
350-
transition: 0.2s;
335+
border: 2px solid var(--border);
336+
border-radius: 4px;
337+
cursor: pointer;
338+
position: relative;
339+
transition: all 0.2s;
351340
}
352341

353-
.toggle-slider:before {
354-
position: absolute;
355-
content: "";
356-
height: 16px;
357-
width: 16px;
358-
left: 3px;
359-
bottom: 3px;
360-
background: white;
361-
border-radius: 50%;
362-
transition: 0.2s;
342+
.checkbox:hover {
343+
border-color: var(--accent);
363344
}
364345

365-
.toggle input:checked + .toggle-slider {
346+
.checkbox:checked {
366347
background: var(--accent);
348+
border-color: var(--accent);
367349
}
368350

369-
.toggle input:checked + .toggle-slider:before {
370-
transform: translateX(18px);
351+
.checkbox:checked::after {
352+
content: '';
353+
position: absolute;
354+
left: 5px;
355+
top: 1px;
356+
width: 6px;
357+
height: 11px;
358+
border: solid #000;
359+
border-width: 0 2px 2px 0;
360+
transform: rotate(45deg);
371361
}
372362

373363
/* Export Preview */
@@ -1200,10 +1190,7 @@ <h3>Sanitized</h3>
12001190
</div>
12011191
</td>
12021192
<td>
1203-
<label class="toggle">
1204-
<input type="checkbox" ${d.enabled ? 'checked' : ''} data-index="${i}">
1205-
<span class="toggle-slider"></span>
1206-
</label>
1193+
<input type="checkbox" class="checkbox" ${d.enabled ? 'checked' : ''} data-index="${i}">
12071194
</td>
12081195
</tr>
12091196
`;

tests/web-app.spec.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,9 @@ test.describe('Web App - Browser Version', () => {
212212

213213
await page.waitForSelector('#step2:not(.hidden)', { timeout: 10000 })
214214

215-
// Toggle off the detection by unchecking the checkbox via JS
216-
await page.evaluate(() => {
217-
const checkbox = document.querySelector('#detectionTable input[type="checkbox"]') as HTMLInputElement
218-
if (checkbox) {
219-
checkbox.checked = false
220-
checkbox.dispatchEvent(new Event('change', { bubbles: true }))
221-
}
222-
})
215+
// Toggle off the detection by clicking the checkbox
216+
const checkbox = page.locator('#detectionTable .checkbox').first()
217+
await checkbox.click()
223218

224219
// Continue to export
225220
await page.click('#continueToExport')

0 commit comments

Comments
 (0)