Skip to content

Commit 64d34ec

Browse files
author
John Goodliff
committed
Update style of checkboxes to match radio buttons
1 parent 2bab15c commit 64d34ec

File tree

3 files changed

+46
-27
lines changed

3 files changed

+46
-27
lines changed

src/assets/styles/index.css

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -477,46 +477,59 @@ input[type='radio'] {
477477
vertical-align: middle;
478478
}
479479

480-
#theme-container {
480+
.config {
481481
display: grid;
482-
grid-template-columns: auto auto;
483-
width: fit-content;
484482
border-radius: var(--border-radius-base);
485483
overflow: hidden;
486484
}
487485

488-
#theme-container > div {
486+
.config.options {
487+
grid-template-columns: auto;
488+
}
489+
490+
.config.themes {
491+
grid-template-columns: auto auto;
492+
}
493+
494+
.config > div {
489495
text-align: center;
490496
white-space: nowrap;
491497
}
492498

493-
#theme-container > div > label {
499+
.config.options > div {
500+
text-align: start;
501+
}
502+
503+
.config > div > label {
494504
display: block;
495505
padding: var(--padding-sm);
496506
background: var(--color-base-1);
507+
color: var(--color-text);
508+
transition-property: background-color, color, opacity;
509+
transition-duration: var(--transition-duration-base);
510+
cursor: pointer;
511+
}
512+
513+
.config.themes > div > label {
497514
background: linear-gradient(
498515
90deg,
499516
var(--color-base-1) 0%,
500-
var(--color-base-1) 49%,
501-
var(--color-base-2) 51%,
517+
var(--color-base-1) 49.9%,
518+
var(--color-base-2) 50.1%,
502519
var(--color-base-2) 100%
503520
);
504-
color: var(--color-text);
505-
transition-property: background-color, color, opacity;
506-
transition-duration: var(--transition-duration-base);
507-
cursor: pointer;
508521
}
509522

510-
#theme-container:hover > div > input[type='radio'] ~ label {
523+
.config:hover > div > input ~ label {
511524
opacity: var(--opacity-hover);
512525
}
513526

514-
#theme-container:hover > div > input[type='radio']:hover ~ label {
527+
.config:hover > div > input:hover ~ label {
515528
opacity: var(--opacity-max);
516529
box-shadow: var(--box-shadow-xl);
517530
}
518531

519-
#theme-container > div > input[type='radio'] {
532+
input {
520533
display: block;
521534
margin: 0;
522535
padding: 0;
@@ -525,18 +538,21 @@ input[type='radio'] {
525538
opacity: var(--opacity-min);
526539
}
527540

528-
#theme-container > div > label:hover,
529-
input[type='radio']:active ~ label {
541+
input:active ~ label {
530542
opacity: var(--opacity-max);
531543
}
532544

533-
#theme-container > div > input[type='radio']:checked ~ label {
545+
input:checked ~ label {
534546
font-weight: var(--font-weight-bolder);
535547
opacity: var(--opacity-max);
536548
box-shadow: var(--box-shadow-xl);
537549
}
538550

539-
#theme-container > div > input[type='radio']:checked ~ label::before {
551+
input[type='checkbox'] ~ label::before {
552+
content: '✗ ';
553+
}
554+
555+
input:checked ~ label::before {
540556
content: '✓ ';
541557
font-weight: var(--font-weight-bolder);
542558
}

src/index.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,19 @@ <h3>Privacy</h3>
209209
</div>
210210
<div>
211211
<h3>Options</h3>
212-
<div>
213-
<input type="checkbox" id="warn-on-large-input-text">
214-
<label for="warn-on-large-input-text">Warn on large input text</label>
215-
<br>
216-
<input type="checkbox" id="remember-input-text">
217-
<label for="remember-input-text">Remember input text</label>
218-
<br>
212+
<div class="config options">
213+
<div>
214+
<input type="checkbox" id="warn-on-large-input-text">
215+
<label for="warn-on-large-input-text">Warn on large input text</label>
216+
</div>
217+
<div>
218+
<input type="checkbox" id="remember-input-text">
219+
<label for="remember-input-text">Remember input text</label>
220+
</div>
219221
</div>
220222

221223
<h3>Themes</h3>
222-
<div id="theme-container"></div>
224+
<div class="config themes"></div>
223225
</div>
224226
</footer>
225227

src/scripts/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ const warnOnLargeInputTextCheckbox = document.getElementById(
6363
const rememberInputTextCheckbox = document.getElementById(
6464
'remember-input-text',
6565
);
66-
const themeSelectorContainer = document.getElementById('theme-container');
66+
const themeSelectorContainer =
67+
document.getElementsByClassName('config themes')[0];
6768
const outputMap = getOutputMap();
6869
const metaTagMatrix = getMetaTagMatrix();
6970
const themeSelectorMap = buildThemeSelectors();

0 commit comments

Comments
 (0)