scinote-web/app/assets/stylesheets/shared/checkbox.scss

100 lines
1.8 KiB
SCSS
Raw Normal View History

2019-08-12 21:02:16 +08:00
// scss-lint:disable SelectorDepth SelectorFormat QualifyingElement
// scss-lint:disable NestingDepth ImportantRule
@import "constants";
@import "mixins";
:root {
--checkbox-size: 16px;
}
2019-08-12 21:02:16 +08:00
input[type="checkbox"].simple-checkbox {
cursor: pointer;
flex-shrink: 0;
height: var(--checkbox-size);
2019-08-12 21:02:16 +08:00
margin: 0;
opacity: 0;
position: relative;
width: var(--checkbox-size);
2019-08-12 21:02:16 +08:00
z-index: 2;
+ .checkbox-label {
display: inline-block;
flex-shrink: 0;
height: var(--checkbox-size);
margin-left: calc((var(--checkbox-size) * -1) - 1px);
2019-08-12 21:02:16 +08:00
position: relative;
width: var(--checkbox-size);
2019-08-12 21:02:16 +08:00
&::before {
content: "\f0c8";
font-family: "Font Awesome 5 Free";
font-size: var(--checkbox-size);
2019-08-12 21:02:16 +08:00
font-weight: 400;
left: 0;
line-height: var(--checkbox-size);
2019-08-12 21:02:16 +08:00
position: absolute;
text-align: center;
top: 1px;
width: var(--checkbox-size);
2019-08-12 21:02:16 +08:00
}
}
&.hidden + .checkbox-label {
display: none;
}
&:checked + .checkbox-label {
&::before {
content: "\f14a";
}
}
}
input[type="checkbox"].trigger-checkbox {
cursor: pointer;
flex-shrink: 0;
height: 16px;
margin: 0;
opacity: 0;
position: relative;
width: 24px;
z-index: 2;
+ .checkbox-label {
background: $color-silver-chalice;
border-radius: 8px;
display: inline-block;
flex-shrink: 0;
height: 16px;
margin-left: -24px;
position: relative;
transition: .2s;
width: 24px;
&::before {
background: $color-white;
border-radius: 7px;
content: "";
height: 12px;
left: 0;
margin: 2px;
position: absolute;
transition: .2s;
width: 12px;
}
}
&.hidden + .checkbox-label {
display: none;
}
&:checked + .checkbox-label {
background: $brand-success;
&::before {
left: 8px;
}
}
}