Spaces:
Paused

nexus / frontend /apps /customer /src /components /Skeleton.tsx
dushyantsingh0
backend stabilization
d02993d
Raw History Blame Contribute Delete
1.01 kB
import React from 'react';
interface SkeletonProps {
width?: string | number;
height?: string | number;
borderRadius?: string | number;
marginBottom?: string | number;
style?: React.CSSProperties;
className?: string;
}
export const Skeleton: React.FC<SkeletonProps> = ({
width = '100%',
height = '1em',
borderRadius = 4,
marginBottom = 0,
style,
className
}) => {
const skeletonStyle: React.CSSProperties = {
width,
height,
borderRadius,
marginBottom,
background: '#E5E7EB',
backgroundImage: 'linear-gradient(90deg, #E5E7EB 0px, #F3F4F6 50%, #E5E7EB 100%)',
backgroundSize: '200% 100%',
animation: 'skeleton-pulse 1.5s infinite linear',
...style
};
return (
<>
<style>
{`
@keyframes skeleton-pulse {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
`}
</style>
<div style={skeletonStyle} className={className} />
</>
);
};