JSFiddle - React, Tailwind, and code Playground
by Victor
HTML
<div class="lh">
<div class="lh__label">Label</div>
<div class="lh__scale">
<div class="lh__scale__one"></div>
<div class="lh__scale__two"></div>
<div class="lh__scale__three"></div>
<div class="lh__scale__four"></div>
<div class="lh__scale__five"></div>
</div>
</div>
SCSS
.lh {
width: 300px;
&__scale {
display: flex;
width: 300px;
max-width: 100%;
overflow: hidden;
border-radius: 40px;
flex-wrap: wrap;
[class^="lh__"] {
height: 30px;
flex: 1;
margin-right: 3px;
transition: all ease 0.3s;
display: flex;
justify-content: center;
align-items: center;
color: white;
background: darken( blue, 4%);
font-size: 12px;
box-shadow: inset 0 0 0 1px darkgrey;
color: transparent;
&:hover {
cursor: pointer;
}
&:first-child {
box-shadow: 0;
border-radius: 50px 0 0 50px;
}
&:last-child {
box-shadow: 0;
border-radius: 0 50px 50px 0;
}
&:nth-child(1) {
background: darken( blue, 16%);
}
&:nth-child(2) {
background: darken( blue, 12%);
}
&:nth-child(3) {
background: darken( blue, 8%);
}
&:nth-child(4) {
background: darken( blue, 4%);
}
&:nth-child(5) {
background: darken( blue, 0%);
}
&:hover,
&.active {
color: white;
+[class^="lh__"] {
background: rgba(255, 255, 255, 1);
+[class^="lh__"] {
background: rgba(255, 255, 255, 1);
+[class^="lh__"] {
background: rgba(255, 255, 255, 1);
+[class^="lh__"] {
background: rgba(255, 255, 255, 1);
}
}
}
}
}
}
}
&__label {
width: 100%;
padding: 5px 0;
flex-basis: 100%;
flex: 1;
text-align: center;
font-size: 10px;
color: grey;
}
}