Skip to content

Commit 6239c90

Browse files
committed
Make shimmer button less visually distracting, and respect reduced-motion
1 parent ea8bc9b commit 6239c90

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

frontend/src/components/shimmer-button.module.css

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
position: absolute;
44
opacity: 0.5;
55

6-
animation: shimmer 3s infinite;
7-
animation-delay: 0.5s;
6+
@media (prefers-reduced-motion: no-preference) {
7+
animation: shimmer 10s infinite;
8+
animation-delay: 0.5s;
9+
}
810
}
911

1012
@keyframes shimmer {
11-
0% {
13+
0%,
14+
85% {
1215
transform: translateX(-150%) scale(1);
1316
}
14-
25% {
17+
92% {
1518
transform: translateX(150%) scale(1.5);
1619
}
17-
50%,
1820
100% {
1921
transform: translateX(150%) scale(1);
2022
}
@@ -90,11 +92,13 @@
9092
}
9193

9294
.button:hover .star {
93-
animation-name: sparkle;
94-
animation-duration: 3s;
95-
animation-delay: calc((var(--delay-step) * var(--d)) * 1s);
96-
animation-fill-mode: both;
97-
animation-iteration-count: infinite;
95+
@media (prefers-reduced-motion: no-preference) {
96+
animation-name: sparkle;
97+
animation-duration: 3s;
98+
animation-delay: calc((var(--delay-step) * var(--d)) * 1s);
99+
animation-fill-mode: both;
100+
animation-iteration-count: infinite;
101+
}
98102
}
99103

100104
@keyframes sparkle {

0 commit comments

Comments
 (0)