UNPKG

1.25 kBCSSView Raw
1@keyframes react-loading-skeleton {
2 100% {
3 transform: translateX(100%);
4 }
5}
6
7.react-loading-skeleton {
8 --base-color: #ebebeb;
9 --highlight-color: #f5f5f5;
10 --animation-duration: 1.5s;
11 --animation-direction: normal;
12 --pseudo-element-display: block; /* Enable animation */
13
14 background-color: var(--base-color);
15
16 width: 100%;
17 border-radius: 0.25rem;
18 display: inline-flex;
19 line-height: 1;
20
21 position: relative;
22 user-select: none;
23 overflow: hidden;
24}
25
26.react-loading-skeleton::after {
27 content: ' ';
28 display: var(--pseudo-element-display);
29 position: absolute;
30 top: 0;
31 left: 0;
32 right: 0;
33 height: 100%;
34 background-repeat: no-repeat;
35 background-image: var(
36 --custom-highlight-background,
37 linear-gradient(
38 90deg,
39 var(--base-color) 0%,
40 var(--highlight-color) 50%,
41 var(--base-color) 100%
42 )
43 );
44 transform: translateX(-100%);
45
46 animation-name: react-loading-skeleton;
47 animation-direction: var(--animation-direction);
48 animation-duration: var(--animation-duration);
49 animation-timing-function: ease-in-out;
50 animation-iteration-count: infinite;
51}
52
53@media (prefers-reduced-motion) {
54 .react-loading-skeleton {
55 --pseudo-element-display: none; /* Disable animation */
56 }
57}