File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ function styleOptionsToCssProperties({
2121 duration,
2222 enableAnimation = true ,
2323} : SkeletonStyleProps & { circle : boolean } ) : CSSProperties {
24- const style : CSSProperties = { }
24+ const style : CSSProperties & Record < `--${ string } ` , string > = { }
2525
26- if ( direction === 'rtl' ) style . animationDirection = 'reverse'
26+ if ( direction === 'rtl' ) style [ '--animation-direction' ] = 'reverse'
2727
28- if ( typeof duration === 'number' ) style . animationDuration = `${ duration } s`
28+ if ( typeof duration === 'number' ) style [ '--animation-duration' ] = `${ duration } s`
2929
3030 if ( typeof width === 'string' || typeof width === 'number' ) style . width = width
3131 if ( typeof height === 'string' || typeof height === 'number' ) style . height = height
@@ -42,13 +42,8 @@ function styleOptionsToCssProperties({
4242 }
4343
4444 if ( typeof baseColor !== 'undefined' || typeof highlightColor !== 'undefined' ) {
45- style . backgroundColor = baseColor ?? defaultBaseColor
46- style . backgroundImage = `linear-gradient(
47- 90deg,
48- ${ baseColor ?? defaultBaseColor } ,
49- ${ highlightColor ?? defaultHighlightColor } ,
50- ${ baseColor ?? defaultBaseColor }
51- )`
45+ style [ '--base-color' ] = baseColor ?? defaultBaseColor ;
46+ style [ '--highlight-color' ] = highlightColor ?? defaultHighlightColor ;
5247 }
5348
5449 if ( ! enableAnimation ) style . backgroundImage = 'none'
Original file line number Diff line number Diff line change 88 /* If either color is changed, Skeleton.tsx must be updated as well */
99 --base-color : # ebebeb ;
1010 --highlight-color : # f5f5f5 ;
11+ --animation-duration : 1.5s ;
12+ --animation-direction : normal;
1113
1214 background-color : var (--base-color );
1315
3739 transform : translateX (-100% );
3840
3941 animation-name : react-loading-skeleton;
40- animation-duration : 1.5s ;
42+ animation-direction : var (--animation-direction );
43+ animation-duration : var (--animation-duration );
4144 animation-timing-function : ease-in-out;
4245 animation-iteration-count : infinite;
4346}
You can’t perform that action at this time.
0 commit comments