rb-buttons
Version:
react-basics button component
100 lines (89 loc) • 1.88 kB
CSS
.rbbutton {
align-items: center;
background-color: cornflowerblue;
border: 0;
border-radius: .75rem;
box-sizing: border-box;
color: white;
cursor: pointer;
display: flex;
font-family: sans-serif;
font-size: 1.1rem;
height: 2.4rem;
justify-content: center;
overflow: hidden;
padding: 0 1.5rem;
position: relative;
transition: all 0.3s cubic-bezier(.25, .8, .25, 1);
}
.rbbutton:hover,
.rbbutton:focus {
filter: brightness(1.15);
outline: none;
}
.rbbutton:active {
filter: brightness(.85);
outline: none;
}
.rbbutton__text {
opacity: 1;
position: block;
transition: all 0.3s cubic-bezier(.25, .8, .25, 1);
user-select: none;
}
@keyframes spinner {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.rbbutton--spinner,
.rbbutton--textSpinner,
.rbbutton--text,
.rbbutton--filler {
cursor: progress;
}
.rbbutton--spinner {
animation: spinner .75s linear 0s infinite;
background-color: transparent;
border-bottom: .4rem solid transparent;
border-left: .4rem solid cornflowerblue;
border-radius: 50%;
border-right: .4rem solid cornflowerblue;
border-top: .4rem solid transparent;
padding: 0;
width: 2.4rem;
}
.rbbutton--spinner > .rbbutton__text {
opacity: 0;
}
.rbbutton--textSpinner > .rbbutton__text {
animation: spinner .75s linear 0s infinite;
border-bottom: .2rem solid transparent;
border-left: .2rem solid white;
border-radius: 50%;
border-right: .2rem solid white;
border-top: .2rem solid transparent;
color: transparent;
height: 1rem;
width: 1rem;
}
@keyframes filler {
from {
width: 0%;
}
to {
width: 100%;
}
}
.rbbutton--filler > .rbbutton__filler {
animation: filler .75s linear 0s infinite;
background-color: rgba(255, 255, 255, .2);
border-radius: .75rem;
bottom: 0;
left: 0;
position: absolute;
top: 0;
}