Skip to content

Instantly share code, notes, and snippets.

@emanueljtc
Created May 31, 2019 20:11
Show Gist options
  • Save emanueljtc/f960fe00537610b48e087fce8d3b6dfc to your computer and use it in GitHub Desktop.
Save emanueljtc/f960fe00537610b48e087fce8d3b6dfc to your computer and use it in GitHub Desktop.
/* CODIGO QUE PERMITE DARLE A X CHECKBOX EL COLOR DE FONDO QUE SE NECESITE SOLO
REMPLAZANDO EL COLOR DE LA VARIABLE $bg-color. */
@import "./mixins/mixins";
$speed: 0.6s;
$gray-dark: #252525;
$bg-color: #c29a69;
$default-spacing: 1rem;
@keyframes effect-in {
0% {
box-shadow: 0 0 0 0 rgba($gray-dark, 0.3);
}
100% {
box-shadow: 0 0 1rem 2rem transparent;
}
}
@keyframes effect-out {
0% {
box-shadow: 0 0 1rem 2rem transparent;
}
100% {
box-shadow: 0 0 0 0 rgba($gray-dark, 0.3);
}
}
.checkbox-group {
position: relative;
&__checkbox {
position: absolute;
opacity: 0;
&:checked + .checkbox-group__label .checkbox-group__pseudo-checkbox::before {
animation: effect-in $speed;
background-color: $bg-color;
transition: background-color $speed linear;
}
&:not(:checked) + .checkbox-group__label .checkbox-group__pseudo-checkbox::before {
animation: effect-out $speed;
background-color: transparent;
transition: background-color $speed linear;
}
}
&__label {
display: flex;
align-items: center;
text-shadow: none;
@include iqos-font;
font-size: 12px;
padding: 1rem;
padding-left: 0;
transition: all 0.3s ease;
&:focus {
outline: 5px solid rgba(255, 0, 0, 0.1);
outline-offset: 1px;
outline: 0;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
transition: all 0.6s ease;
}
}
&__pseudo-checkbox {
display: flex;
justify-content: space-around;
align-items: center;
width: 1em;
height: 1em;
padding: 2px;
border: 2px solid $gray-dark;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 50%;
&::before {
content: "";
width: 100%;
height: 100%;
border-radius: 50%;
background-color: $bg-color;
}
}
&__label-text {
margin-left: 1em;
letter-spacing: 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment