Skip to content

Commit cf6ed91

Browse files
committed
feat: format labels and handle range slider growing on resize using flex
1 parent aecd2bb commit cf6ed91

File tree

1 file changed

+53
-36
lines changed

1 file changed

+53
-36
lines changed
Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<template>
2-
<div class="pagination-wrap">
3-
<input class="pagination" type="range" />
2+
<div class="pagination-component">
3+
<label class="page-label">Page 1</label>
4+
<div class="input-wrap">
5+
<input class="pagination" type="range" />
6+
</div>
7+
<label class="page-label">Page 10</label>
48
</div>
59
</template>
610

@@ -17,13 +21,32 @@ export default {
1721
</script>
1822

1923
<style lang="scss">
20-
.pagination-wrap {
24+
.pagination-component {
2125
display: flex;
22-
flex-direction: column;
26+
flex-flow: row wrap;
2327
height: 45vh;
2428
29+
label.page-label {
30+
display: flex;
31+
color: $secondary-font-color;
32+
font-size: 0.8125rem;
33+
flex: 1 100%;
34+
}
35+
36+
div.input-wrap {
37+
display: flex;
38+
height: 45vh;
39+
padding-left: 0.625rem;
40+
41+
input.pagination {
42+
transform: rotate(90deg);
43+
transform-origin: left;
44+
height: 1rem;
45+
width: 43vh;
46+
}
47+
}
48+
2549
input[type=range] {
26-
margin: 1.85px 0;
2750
background-color: transparent;
2851
-webkit-appearance: none;
2952
color: red;
@@ -33,21 +56,21 @@ export default {
3356
}
3457
input[type=range]::-webkit-slider-runnable-track {
3558
background: $border-color;
36-
border: 0px solid $border-color;
59+
border: 0 solid $border-color;
3760
border: 0;
38-
border-radius: 25px;
61+
border-radius: 1.5625rem;
3962
width: 100%;
40-
height: 1.3px;
63+
height: 0.08125rem;
4164
cursor: pointer;
4265
}
4366
input[type=range]::-webkit-slider-thumb {
44-
margin-top: -1.85px;
45-
width: 43px;
46-
height: 5px;
67+
margin-top: -0.115625rem;
68+
width: 2.6875rem;
69+
height: 0.3125rem;
4770
background: $color-primary;
48-
border: 0px solid $border-color;
71+
border: 0 solid $border-color;
4972
border: 0;
50-
border-radius: 50px;
73+
border-radius: 3.125rem;
5174
cursor: pointer;
5275
-webkit-appearance: none;
5376
}
@@ -56,51 +79,51 @@ export default {
5679
}
5780
input[type=range]::-moz-range-track {
5881
background: $border-color;
59-
border: 0px solid $border-color;
82+
border: 0 solid $border-color;
6083
border: 0;
61-
border-radius: 25px;
84+
border-radius: 1.5625rem;
6285
width: 100%;
63-
height: 1.3px;
86+
height: 0.08125rem;
6487
cursor: pointer;
6588
}
6689
input[type=range]::-moz-range-thumb {
67-
width: 43px;
68-
height: 5px;
90+
width: 2.6875rem;
91+
height: 0.3125rem;
6992
background: $color-primary;
70-
border: 0px solid $border-color;
93+
border: 0 solid $border-color;
7194
border: 0;
72-
border-radius: 50px;
95+
border-radius: 3.125rem;
7396
cursor: pointer;
7497
}
7598
input[type=range]::-ms-track {
7699
background: transparent;
77100
border-color: transparent;
78-
border-width: 1.85px 0;
101+
border-width: 0.115625rem 0;
79102
color: transparent;
80103
width: 100%;
81-
height: 1.3px;
104+
height: 0.08125rem;
82105
cursor: pointer;
83106
}
84107
input[type=range]::-ms-fill-lower {
85108
background: $border-color;
86-
border: 0px solid $border-color;
109+
border: 0 solid $border-color;
87110
border: 0;
88-
border-radius: 50px;
111+
border-radius: 3.125rem;
89112
}
90113
input[type=range]::-ms-fill-upper {
91114
background: $border-color;
92-
border: 0px solid $border-color;
115+
border: 0 solid $border-color;
93116
border: 0;
94-
border-radius: 50px;
117+
border-radius: 3.125rem;
95118
}
96119
input[type=range]::-ms-thumb {
97-
width: 43px;
98-
height: 5px;
120+
width: 2.6875rem;
121+
height: 0.3125rem;
99122
background: $color-primary;
100123
border: 0;
101-
border-radius: 50px;
124+
border-radius: 3.125rem;
102125
cursor: pointer;
103-
margin-top: 0px;
126+
margin-top: 0;
104127
/*Needed to keep the Edge thumb centred*/
105128
}
106129
input[type=range]:focus::-ms-fill-lower {
@@ -119,11 +142,5 @@ export default {
119142
/*Edge starts the margin from the thumb, not the track as other browsers do*/
120143
}
121144
}
122-
123-
input.pagination {
124-
transform: rotate(90deg);
125-
transform-origin: left;
126-
width: 100%;
127-
}
128145
}
129146
</style>

0 commit comments

Comments
 (0)