Skip to content

Commit dfe859d

Browse files
authored
Animate skeleton component with transform (#29168)
## Summary & Motivation using `transform` allows us to take advantage of GPU acceleration. In-depth explanation here https://www.smashingmagazine.com/2016/12/gpu-animation-doing-it-right/ ## How I Tested These Changes Side by side comparison: left is current, right is this PR. https://github.com/user-attachments/assets/a75693d0-89b5-4378-a767-0ac4036e67f6
1 parent 5b44544 commit dfe859d

File tree

1 file changed

+21
-13
lines changed
  • js_modules/dagster-ui/packages/ui-components/src/components

1 file changed

+21
-13
lines changed

js_modules/dagster-ui/packages/ui-components/src/components/Skeleton.tsx

+21-13
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,32 @@ export const Skeleton = styled.div<{$height?: string | number; $width?: string |
88
display: block;
99
min-height: 1.5em;
1010
border-radius: 6px;
11-
background: linear-gradient(
12-
90deg,
13-
${Colors.backgroundLight()} 25%,
14-
${Colors.backgroundLightHover()} 37%,
15-
${Colors.backgroundLight()} 63%
16-
);
17-
background-size: 400% 100%;
18-
animation-name: skeleton-loading;
19-
animation-duration: 1.4s;
20-
animation-timing-function: ease;
21-
animation-iteration-count: infinite;
11+
background: ${Colors.backgroundLight()};
12+
position: relative;
13+
overflow: hidden;
14+
15+
&::after {
16+
content: '';
17+
position: absolute;
18+
top: 0;
19+
right: 0;
20+
bottom: 0;
21+
left: 0;
22+
background: linear-gradient(
23+
90deg,
24+
${Colors.backgroundLight()} 0%,
25+
${Colors.backgroundLightHover()} 50%,
26+
${Colors.backgroundLight()} 100%
27+
);
28+
animation: skeleton-loading 1.4s ease infinite;
29+
}
2230
2331
@keyframes skeleton-loading {
2432
0% {
25-
background-position: 100% 50%;
33+
transform: translateX(-100%);
2634
}
2735
100% {
28-
background-position: 0 50%;
36+
transform: translateX(100%);
2937
}
3038
}
3139
`;

0 commit comments

Comments
 (0)