import type { FC } from 'react'; import { Skeleton, theme } from 'antd'; type LoadingMode = 'grid' | 'list'; interface LoadingSkeletonProps { mode: LoadingMode; count?: number; } const createArray = (length: number) => Array.from({ length }, (_, index) => index); export const LoadingSkeleton: FC = ({ mode, count }) => { const { token } = theme.useToken(); const fallbackCount = mode === 'grid' ? 50 : 30; const items = createArray(count ?? fallbackCount); if (mode === 'grid') { return (
{items.map((key) => (
))}
); } return (
{items.map((key) => (
))}
); };