소스 검색

fix loader prop warning (#1016)

Bartosz Dryl 3 년 전
부모
커밋
b50f0afba6
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      src/shared/components/Loader/Loader.tsx

+ 6 - 4
src/shared/components/Loader/Loader.tsx

@@ -29,10 +29,12 @@ const VARIANT_TO_CONFIG: Record<LoaderVariant, LoaderConfig> = {
 
 export const Loader: React.FC<LoaderProps> = ({ variant = 'medium', className }) => {
   const config = VARIANT_TO_CONFIG[variant]
-  return <StyledLottie play animationData={config.data} $size={config.size} className={className} />
+  return <StyledLottie play animationData={config.data} size={config.size} className={className} />
 }
 
-const StyledLottie = styled(Lottie)<{ $size: number }>`
-  width: ${({ $size }) => `${$size}px`};
-  height: ${({ $size }) => `${$size}px`};
+const StyledLottie = styled(Lottie, {
+  shouldForwardProp: (prop) => prop !== 'size',
+})<{ size: number }>`
+  width: ${({ size }) => `${size}px`};
+  height: ${({ size }) => `${size}px`};
 `