import React from 'react'; import { cn } from '../../lib/utils'; interface SkeletonProps { className?: string; variant?: 'text' | 'circular' | 'rectangular'; width?: string | number; height?: string | number; animation?: 'pulse' | 'wave' | 'none'; } export const Skeleton: React.FC = ({ className, variant = 'rectangular', width, height, animation = 'pulse' }) => { const baseClasses = 'bg-neutral-200'; const animationClasses = { pulse: 'animate-pulse', wave: 'animate-shimmer', none: '' }; const variantClasses = { text: 'rounded', circular: 'rounded-full', rectangular: 'rounded-lg' }; const style: React.CSSProperties = {}; if (width) style.width = typeof width === 'number' ? `${width}px` : width; if (height) style.height = typeof height === 'number' ? `${height}px` : height; return (
); }; // Skeleton group for consistent loading states interface SkeletonGroupProps { count?: number; className?: string; children?: React.ReactNode; } export const SkeletonGroup: React.FC = ({ count = 1, className, children }) => { if (children) { return
{children}
; } return (
{Array.from({ length: count }).map((_, index) => ( ))}
); }; // Common skeleton patterns export const SkeletonCard: React.FC<{ className?: string }> = ({ className }) => (
); export const SkeletonTable: React.FC<{ rows?: number; className?: string }> = ({ rows = 5, className }) => (
{Array.from({ length: rows }).map((_, index) => (
))}
); export const SkeletonGalleryGrid: React.FC<{ count?: number; className?: string }> = ({ count = 12, className }) => (
{Array.from({ length: count }).map((_, index) => ( ))}
); export const SkeletonList: React.FC<{ count?: number; className?: string }> = ({ count = 5, className }) => (
{Array.from({ length: count }).map((_, index) => (
))}
);