import "./Skeleton.css"; const toCSS = (value: string | number) => typeof value === "number" ? `${value}px` : value; interface SkeletonLineProps { width?: string | number; height?: string | number; borderRadius?: string; } const SkeletonLine = ({ width, height, borderRadius }: SkeletonLineProps) => (
); interface SkeletonProps { width?: string | number; height?: string | number; borderRadius?: string; lines?: number; className?: string; } const Skeleton = ({ width = "100%", height = "1rem", borderRadius = "4px", lines = 1, className, }: SkeletonProps) => { if (lines === 1) { return ( ); } const lineItems = Array.from({ length: lines }, (_, i) => ({ id: `line-${i}`, isLast: i === lines - 1, })); return (