Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit b20d3d7

Browse files
refactor(slider): Separate static styles to separate mixin in MDC slider
PiperOrigin-RevId: 465421143
1 parent 1019664 commit b20d3d7

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

packages/mdc-slider/_slider.scss

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ $_track-inactive-height: 4px;
5656
// It is recommended that most users use `core-styles` instead.
5757
@mixin without-ripple($query: feature-targeting.all()) {
5858
$feat-color: feature-targeting.create-target($query, color);
59+
$feat-structure: feature-targeting.create-target($query, structure);
5960

6061
@include static-styles($query: $query);
6162

@@ -115,6 +116,39 @@ $_track-inactive-height: 4px;
115116
$color: slider-theme.$value-indicator-text-color,
116117
$query: $query
117118
);
119+
120+
.mdc-slider__track {
121+
@include feature-targeting.targets($feat-structure) {
122+
height: $_track-inactive-height;
123+
}
124+
}
125+
126+
.mdc-slider__track--active {
127+
@include feature-targeting.targets($feat-structure) {
128+
height: $_track-active-height;
129+
}
130+
}
131+
132+
.mdc-slider__track--inactive {
133+
@include feature-targeting.targets($feat-structure) {
134+
height: $_track-inactive-height;
135+
}
136+
}
137+
138+
.mdc-slider__thumb {
139+
@include feature-targeting.targets($feat-structure) {
140+
height: $_thumb-ripple-size;
141+
width: $_thumb-ripple-size;
142+
}
143+
}
144+
145+
.mdc-slider__tick-mark--active,
146+
.mdc-slider__tick-mark--inactive {
147+
@include feature-targeting.targets($feat-structure) {
148+
height: 2px;
149+
width: 2px;
150+
}
151+
}
118152
}
119153

120154
.mdc-slider--disabled {
@@ -198,7 +232,6 @@ $_track-inactive-height: 4px;
198232

199233
.mdc-slider__track {
200234
@include feature-targeting.targets($feat-structure) {
201-
height: $_track-inactive-height;
202235
position: absolute;
203236
top: 50%;
204237
transform: translateY(-50%);
@@ -223,8 +256,6 @@ $_track-inactive-height: 4px;
223256
// such that the track grows/shrinks as needed, but the border-radius
224257
// is not affected by the scaling.
225258
border-radius: 3px;
226-
//TODO(b/241274018): not static, move into themeable styles
227-
height: $_track-active-height;
228259
overflow: hidden;
229260
top: math.div($_track-inactive-height - $_track-active-height, 2);
230261
}
@@ -259,7 +290,6 @@ $_track-inactive-height: 4px;
259290

260291
@include feature-targeting.targets($feat-structure) {
261292
border-radius: 2px;
262-
height: $_track-inactive-height;
263293
left: 0;
264294
top: 0;
265295
}
@@ -275,14 +305,11 @@ $_track-inactive-height: 4px;
275305
.mdc-slider__thumb {
276306
@include feature-targeting.targets($feat-structure) {
277307
display: flex;
278-
//TODO(b/241274018): not static, move (+ width) to themeable styles
279-
height: $_thumb-ripple-size;
280308
@include rtl.ignore-next-line();
281309
left: math.div(-$_thumb-ripple-size, 2);
282310
outline: none;
283311
position: absolute;
284312
user-select: none;
285-
width: $_thumb-ripple-size;
286313
}
287314

288315
&--top {
@@ -342,9 +369,6 @@ $_track-inactive-height: 4px;
342369
.mdc-slider__tick-mark--inactive {
343370
@include feature-targeting.targets($feat-structure) {
344371
border-radius: 50%;
345-
//TODO(b/241274018): not static, move (+ width) to themeable styles
346-
height: 2px;
347-
width: 2px;
348372
}
349373
}
350374
}

0 commit comments

Comments
 (0)