118 lines
2.3 KiB
SCSS
118 lines
2.3 KiB
SCSS
|
.checkbox {
|
||
|
position: relative;
|
||
|
|
||
|
.checkbox-decoration {
|
||
|
display: flex;
|
||
|
position: relative;
|
||
|
width: 24px;
|
||
|
height: 24px;
|
||
|
overflow: hidden;
|
||
|
border: 1px solid $checkbox__border-color;
|
||
|
border-radius: 2px;
|
||
|
pointer-events: none;
|
||
|
}
|
||
|
|
||
|
.checkbox-check {
|
||
|
transform-origin: 50% 50%;
|
||
|
stroke-width: 2;
|
||
|
stroke-dasharray: 48;
|
||
|
stroke-dashoffset: 48;
|
||
|
stroke: $checkbox-stroke__color;
|
||
|
}
|
||
|
|
||
|
.checkbox-decorationMedia {
|
||
|
display: flex;
|
||
|
position: relative;
|
||
|
width: 18px;
|
||
|
margin-right: auto;
|
||
|
margin-left: auto;
|
||
|
transform: translateY(3px);
|
||
|
}
|
||
|
|
||
|
.checkbox-input {
|
||
|
position: absolute;
|
||
|
-webkit-appearance: none;
|
||
|
appearance: none;
|
||
|
top: 0;
|
||
|
left: 0;
|
||
|
width: 24px;
|
||
|
height: 24px;
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
border-radius: 3px;
|
||
|
background: $checkbox__bg-color;
|
||
|
cursor: pointer;
|
||
|
|
||
|
&::before {
|
||
|
content: ' ';
|
||
|
position: absolute;
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
background-image: url('../assets/icons/common/check-hover.svg');
|
||
|
background-repeat: no-repeat;
|
||
|
background-position: center;
|
||
|
}
|
||
|
|
||
|
&::after {
|
||
|
content: '';
|
||
|
position: absolute;
|
||
|
top: -3px;
|
||
|
left: -3px;
|
||
|
width: calc(100% + 6px);
|
||
|
height: calc(100% + 6px);
|
||
|
}
|
||
|
|
||
|
&:hover + .checkbox-decoration {
|
||
|
border: 1px solid $checkbox__border-color--hover;
|
||
|
}
|
||
|
|
||
|
&.is-selected,
|
||
|
&:checked {
|
||
|
+ .checkbox-decoration {
|
||
|
border: 1px solid $checkbox__border-color--hover;
|
||
|
|
||
|
&::before {
|
||
|
content: "";
|
||
|
display: block;
|
||
|
position: absolute;
|
||
|
top: calc(50% - 12px);
|
||
|
left: calc(50% - 12px);
|
||
|
width: 24px;
|
||
|
height: 24px;
|
||
|
animation: radioIn 300ms;
|
||
|
border-radius: 3px;
|
||
|
opacity: 1;
|
||
|
animation-fill-mode: forwards;
|
||
|
background: $checkbox__bg-color--selected;
|
||
|
}
|
||
|
|
||
|
.checkbox-check {
|
||
|
animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 300ms forwards;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
&:focus {
|
||
|
outline: none;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@keyframes stroke {
|
||
|
100% {
|
||
|
stroke-dashoffset: 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@keyframes radioIn {
|
||
|
0% {
|
||
|
transform: scale3d(0.3, 0.3, 0.3);
|
||
|
opacity: 0;
|
||
|
}
|
||
|
|
||
|
to {
|
||
|
transform: scale3d(1, 1, 1);
|
||
|
opacity: 1;
|
||
|
}
|
||
|
}
|