Skip to content

Commit

Permalink
style :: 스켈레톤
Browse files Browse the repository at this point in the history
  • Loading branch information
dutexion committed Aug 20, 2024
1 parent 7a26f48 commit ed0e128
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/components/common/Skeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import styled from '@emotion/styled';

interface SkeletonProps {
width?: number;
height?: number;
radius?: number;
}

const SkeletonDiv = styled.div<SkeletonProps>`
background-color: #e0e0e0;
border-radius: ${({ radius }) => `${radius}px`};
width: 100%;
max-width: ${({ width }) => `${width}px`};
height: ${({ height }) => `${height}px`};
animation: pulse 1.5s infinite;
@keyframes pulse {
0% {
background-color: #e0e0e0;
}
50% {
background-color: #f0f0f0;
}
100% {
background-color: #e0e0e0;
}
}
`;

const Skeleton = ({ width = 1120, height = 200, radius = 4 }: SkeletonProps) => {
return <SkeletonDiv width={width} height={height} radius={radius} />;
};

export default Skeleton;

0 comments on commit ed0e128

Please sign in to comment.