nw-react-slider--bki
Version:
Slider Component
210 lines (188 loc) • 4.27 kB
text/less
.slider-container-component {
position: relative;
@white: #ffffff;
@darkestgrey: #464646;
@darkergrey: #929292;
@grey: #bcbcbc;
@lightergrey: #dcdcdc;
@lightestgrey: #f8f8f8;
@rainbow: linear-gradient(to right, #F660FF, #65BAFA, #8FEC51);
@medium-shadow: 0 1px 3px 0px fade(black, 15%);
.slider {
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
margin: 6px 0;
&__track {
position: relative;
height: 12px;
cursor: pointer;
background: @rainbow;
border-radius: 6px;
margin: 6px 12px;
box-shadow: inset 0 0 0 1px fade(black, 20%);
}
&__handle {
user-select: none;
border: 1px solid @grey;
height: 24px;
width: 24px;
border-radius: 12px;
background: @white;
cursor: pointer;
box-shadow: @medium-shadow;
margin-top: -6px;
display: inline-block;
position: absolute;
z-index: 1;
transition: transform .2s ease;
&.react-draggable-dragging {
transition: none;
}
}
&__ticks, &__markers {
position: absolute;
width: 100%;
margin-top: 1px;
line-height: 0;
cursor: pointer;
pointer-events: none;
}
&__markers {
transform: translateY(-24px);
}
&__markers--bottom {
transform: translateY(24px);
}
&__tick {
width: 1px;
background-color: rgba(0,0,0,0.2);
height: 10px;
display: inline-block;
margin-left: -1px;
pointer-events: none;
position: absolute;
&--marker{
margin-left:~"calc(50% - 1px)";
margin-top: 8px;
}
}
&__fill {
position: absolute;
left: 1px;
top: 1px;
bottom: 1px;
right: 1px;
background-color: rgba(0,0,0,0.2);
border-radius: 6px;
transition: right .2s ease-in-out;
}
&__ticks--circle {
.slider__tick {
width: 10px;
background: white;
border-radius: 10px;
}
}
}
.slider__marker, .marker{
display: inline-block;
position: absolute;
transform: translateX(-50%);
height: 10px;
}
.marker__label{
margin: 0;
line-height: 1;
}
// Popover CSS
&.dragging .popover-container > .popover {
transition: none;
}
.popover-container {
margin-top: 12px;
.popover {
transition: left .2s ease;
background: #fff;
border: 1px solid @lightergrey;
box-shadow: @medium-shadow;
width: 150px;
left: -61px;
transform: translateX(~'calc(-50% + 14px)');
height: 50px;
padding: 10px;
font-size: 14px;
line-height: 20px;
color: @darkestgrey;
text-align: center;
border-radius: 4px;
cursor: initial;
position: absolute;
&__arrow {
position: absolute;
background: #ffffff;
height: 6px;
width: 12px;
top: 0;
margin-left: 0;
left: 50%;
border: none;
&:after, &:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: relative;
pointer-events: none;
}
&:after {
border-color: rgba(255, 255, 255, 0);
border-width: 5px;
margin-left: -5px;
top: initial;
}
&:before {
border-color: rgba(220, 220, 220, 0);
border-width: 6px;
margin-left: -6px;
}
}
}
&--arrow-bottom {
.popover {
&__arrow {
&:after {
border-bottom-color: #ffffff;
top: -23px;
left: 3px;
}
&:before {
top: -24px;
left: 9px;
border-bottom-color: #dcdcdc;
}
}
}
}
&--arrow-top {
.popover {
bottom: 30px;
&__arrow {
top: initial;
bottom: -16px;
margin-left: 3px;
&:after {
top: -7px;
left: 0px;
border-top-color: #ffffff;
}
&:before {
top: -6px;
border-top-color: #dcdcdc;
}
}
}
}
}
}