import React from 'react'; import type { SkeletonListProps } from '../../../../types/skeleton'; import { List, type ListItemProps } from '../../../list/public'; import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope'; import { Skeleton } from './Skeleton'; import { SkeletonText } from './SkeletonText'; function clampRows(rows: number): number { if (!Number.isFinite(rows)) { return 1; } return Math.max(1, Math.floor(rows)); } function renderLeading({ avatar, media }: Pick) { if (media) { return ; } if (avatar) { return ; } return undefined; } function SkeletonListInner({ themeId: _themeId, mode: _mode, testID, rows = 5, avatar = false, media = false, lines = 2, variant = 'divider', compact = false, }: SkeletonListProps) { const rowCount = clampRows(rows); const items: ListItemProps[] = Array.from({ length: rowCount }).map(() => ({ compact, description: , leading: renderLeading({ avatar, media }), title: , variant, })); return ; } /*** * Skeleton placeholder list for loading states in list views. * */ export const SkeletonList = withZoraThemeScope(SkeletonListInner);