-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidy up defence box styles, including focus indicators
- Loading branch information
1 parent
a39a3b8
commit eae4fbd
Showing
4 changed files
with
90 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,92 @@ | ||
.defence-mechanism { | ||
position: relative; | ||
padding: 12px 14px; | ||
cursor: default; | ||
} | ||
|
||
.defence-mechanism details summary { | ||
font-size: 1rem; | ||
font-style: normal; | ||
font-weight: 400; | ||
margin: 0; | ||
.defence-mechanism > * { | ||
padding: 0.75rem; | ||
} | ||
|
||
.defence-mechanism > .info-box { | ||
font-size: 0.875rem; | ||
margin-top: 4px; | ||
} | ||
|
||
.validation-text { | ||
font-size: 0.875rem; | ||
font-weight: 600; | ||
.defence-mechanism > summary { | ||
position: relative; | ||
font-size: 1rem; | ||
} | ||
|
||
/* | ||
* Modified from https://www.w3schools.com/howto/howto_css_switch.asp | ||
*/ | ||
|
||
/* The switch - the box around the slider */ | ||
.switch { | ||
.defence-mechanism label.switch { | ||
position: absolute; | ||
display: inline-block; | ||
width: 29px; | ||
height: 13px; | ||
right: 16px; | ||
top: 15px; | ||
width: 2rem; | ||
height: 1rem; | ||
right: 0.75rem; | ||
top: 0.75rem; | ||
} | ||
|
||
.switch:focus-within { | ||
.defence-mechanism label.switch:focus-within { | ||
outline: white auto 1px; | ||
border-radius: 34px; | ||
border-radius: 0.5rem; | ||
} | ||
|
||
/* Hide default HTML checkbox */ | ||
.switch input { | ||
.defence-mechanism label.switch > input { | ||
opacity: 0; | ||
width: 0; | ||
height: 0; | ||
} | ||
|
||
.defence-mechanism label.switch > input:checked + .slider { | ||
background-color: var(--main-toggle-on-colour); | ||
} | ||
|
||
.defence-mechanism label.switch > input:focus + .slider { | ||
box-shadow: 0 0 1px var(--main-toggle-on-colour); | ||
} | ||
|
||
.defence-mechanism label.switch > input:checked + .slider:before { | ||
transform: translateX(1rem); | ||
} | ||
|
||
/* The slider */ | ||
.slider { | ||
.defence-mechanism label.switch > .slider { | ||
position: absolute; | ||
cursor: pointer; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: var(--main-toggle-off-colour); | ||
-webkit-transition: 0.4s; | ||
transition: 0.4s; | ||
} | ||
|
||
.slider:before { | ||
position: absolute; | ||
.defence-mechanism label.switch > .slider:before { | ||
content: ""; | ||
height: 13px; | ||
width: 13px; | ||
position: absolute; | ||
height: 1rem; | ||
width: 1rem; | ||
background-color: var(--main-toggle-ball-colour); | ||
-webkit-transition: 0.4s; | ||
transition: 0.4s; | ||
} | ||
|
||
input:checked + .slider { | ||
background-color: var(--main-toggle-on-colour); | ||
/* Rounded sliders */ | ||
.defence-mechanism label.switch > .slider.round { | ||
border-radius: 0.5rem; | ||
} | ||
|
||
input:focus + .slider { | ||
box-shadow: 0 0 1px var(--main-toggle-on-colour); | ||
.defence-mechanism label.switch > .slider.round:before { | ||
border-radius: 50%; | ||
} | ||
|
||
input:checked + .slider:before { | ||
-webkit-transform: translateX(16px); | ||
-ms-transform: translateX(16px); | ||
transform: translateX(16px); | ||
.defence-mechanism .info-box { | ||
font-size: 0.875rem; | ||
} | ||
|
||
/* Rounded sliders */ | ||
.slider.round { | ||
border-radius: 34px; | ||
.defence-mechanism .info-box :first-child { | ||
margin-top: 0; | ||
} | ||
|
||
.slider.round:before { | ||
border-radius: 50%; | ||
.defence-mechanism .info-box .validation-text { | ||
font-size: inherit; | ||
font-weight: 600; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters