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

Commit 1ae8130

Browse files
allan-chencopybara-github
authored andcommitted
refactor(circular-progress): Refactor spinner layer and color animation
This change allows users who want to use only one color spinner to discard the extraneous DOM elements associated with the other 3 colors. It extracts 2 key animations into variables such that: - The spinning animation is applied to the mdc-circular-progress__spinner-layer class only - Both spinning + color change animations are applied to the mdc-circular-progress__color-{1,2,3,4} classes. So the spinning logic no longer relies on the presence of any color classes. PiperOrigin-RevId: 300197675
1 parent 4971637 commit 1ae8130

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

packages/mdc-circular-progress/_mixins.scss

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,29 @@
256256
}
257257
}
258258

259+
$spinner-rotate-animation:
260+
mdc-circular-progress-spinner-layer-rotate
261+
4 * variables.$arc-time
262+
variables.$timing-function
263+
infinite both;
264+
265+
.mdc-circular-progress__spinner-layer {
266+
@include feature-targeting-mixins.targets($feat-animation) {
267+
animation: $spinner-rotate-animation;
268+
}
269+
}
270+
259271
@for $i from 1 through 4 {
272+
$color-fade-in-out-animation:
273+
mdc-circular-progress-color-#{$i}-fade-in-out
274+
4 * variables.$arc-time
275+
variables.$timing-function
276+
infinite both;
277+
260278
.mdc-circular-progress__color-#{$i} {
261279
@include feature-targeting-mixins.targets($feat-animation) {
262280
animation:
263-
mdc-circular-progress-spinner-layer-rotate 4 * variables.$arc-time variables.$timing-function
264-
infinite both,
265-
mdc-circular-progress-color-#{$i}-fade-in-out 4 * variables.$arc-time variables.$timing-function
266-
infinite both;
281+
$spinner-rotate-animation, $color-fade-in-out-animation;
267282
}
268283
}
269284
}

0 commit comments

Comments
 (0)