Skip to content

Commit 3b78154

Browse files
committed
Clean up transitions and use one element for the tag
1 parent 46568bd commit 3b78154

File tree

1 file changed

+15
-34
lines changed

1 file changed

+15
-34
lines changed

src/components/slider/slider.scss

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ $md-slider-disabled-color: rgba(black, 0.26);
2121
$md-slider-thumb-arrow-height: 16px !default;
2222
$md-slider-thumb-arrow-width: 28px !default;
2323

24-
$md-slider-thumb-label-height: 28px !default;
25-
$md-slider-thumb-label-width: 28px !default;
24+
$md-slider-thumb-label-size: 28px !default;
2625
// The thumb has to be moved down so that it appears right over the slider track when visible and
2726
// on the slider track when not.
2827
$md-slider-thumb-label-top: ($md-slider-thickness / 2) -
29-
($md-slider-thumb-default-scale * $md-slider-thumb-size / 2) - $md-slider-thumb-label-height -
28+
($md-slider-thumb-default-scale * $md-slider-thumb-size / 2) - $md-slider-thumb-label-size -
3029
$md-slider-thumb-arrow-height + 10px !default;
3130

3231
/**
@@ -154,41 +153,26 @@ md-slider *::after {
154153
justify-content: center;
155154

156155
position: absolute;
157-
left: -($md-slider-thumb-label-height / 2);
156+
left: -($md-slider-thumb-label-size / 2);
158157
top: $md-slider-thumb-label-top;
159-
width: $md-slider-thumb-label-width;
160-
height: $md-slider-thumb-label-height;
161-
border-radius: max($md-slider-thumb-label-height, $md-slider-thumb-label-width);
158+
width: $md-slider-thumb-label-size;
159+
height: $md-slider-thumb-label-size;
160+
border-radius: 50%;
162161

163-
transform: scale(0.4) translate3d(0, (-$md-slider-thumb-label-top + 10) / 0.4, 0);
162+
transform: scale(0.4) translate3d(0, (-$md-slider-thumb-label-top + 10) / 0.4, 0) rotate(45deg);
164163
transition: 300ms $swift-ease-in-out-timing-function;
164+
transition-property: transform, border-radius;
165165

166166
background-color: md-color($md-accent);
167167
}
168168

169-
.md-slider-thumb-label::after {
170-
position: absolute;
171-
content: '';
172-
border-radius: $md-slider-thumb-arrow-height;
173-
top: 19px;
174-
border-left: $md-slider-thumb-arrow-width / 2 solid transparent;
175-
border-right: $md-slider-thumb-arrow-width / 2 solid transparent;
176-
border-top-width: $md-slider-thumb-arrow-height;
177-
border-top-style: solid;
178-
179-
opacity: 0;
180-
transform: translate3d(0, -8px, 0);
181-
transition: 200ms $swift-ease-in-out-timing-function;
182-
183-
border-top-color: md-color($md-accent);
184-
}
185-
186169
.md-slider-thumb-label-text {
187170
z-index: 1;
188171
font-size: 12px;
189172
font-weight: bold;
190173
opacity: 0;
191-
transition: 300ms $swift-ease-in-out-timing-function;
174+
transform: rotate(-45deg);
175+
transition: opacity 300ms $swift-ease-in-out-timing-function;
192176
color: white;
193177
}
194178

@@ -210,14 +194,11 @@ md-slider *::after {
210194
transform: scale($md-slider-thumb-focus-scale);
211195
}
212196

213-
.md-slider-active .md-slider-thumb-label,
214-
.md-slider-active .md-slider-thumb-label::after,
215-
.md-slider-active .md-slider-thumb-label-text {
216-
opacity: 1;
217-
transform: translate3d(0, 0, 0) scale(1);
197+
.md-slider-active .md-slider-thumb-label {
198+
border-radius: 50% 50% 0;
199+
transform: rotate(45deg);
218200
}
219201

220-
.md-slider-disabled .md-slider-thumb::after {
221-
background-color: $md-slider-disabled-color;
222-
border-color: $md-slider-disabled-color;
202+
.md-slider-active .md-slider-thumb-label-text {
203+
opacity: 1;
223204
}

0 commit comments

Comments
 (0)