🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { Center, Checkbox, cssVar, Flexbox, Skeleton } from '@lobehub/ui';
import { useDensityTokens } from '@/styles/density';
import { FILE_DATE_WIDTH, FILE_SIZE_WIDTH, getListViewMinWidth } from './ListItem/constants';
interface ListViewSkeletonProps {
columnWidths?: {
date: number;
name: number;
size: number;
uploader: number;
};
count?: number;
showUploader?: boolean;
}
const ListViewSkeleton = ({
columnWidths = { date: FILE_DATE_WIDTH, name: 400, size: FILE_SIZE_WIDTH, uploader: 180 },
count = 6,
showUploader = true,
}: ListViewSkeletonProps) => {
const { listRowHeight } = useDensityTokens();
// Calculate opacity gradient from 100% to 20%
const getOpacity = (index: number) => 1 - (index / (count - 1)) * 0.8;
return (
<Flexbox>
{Array.from({ length: count }).map((_, index) => (
<Flexbox
horizontal
align={'center'}
height={listRowHeight}
key={index}
paddingInline={8}
style={{
background: index % 2 === 0 ? cssVar.colorFillQuaternary : 'transparent',
borderBlockEnd: `1px solid ${cssVar.colorBorderSecondary}`,
minWidth: getListViewMinWidth(showUploader),
opacity: getOpacity(index),
}}
>
<Center height={40} style={{ paddingInline: 4 }}>
<Checkbox disabled />
</Center>
<Flexbox
horizontal
align={'center'}
style={{
flexShrink: 0,
maxWidth: columnWidths.name,
minWidth: columnWidths.name,
paddingInline: 8,
width: columnWidths.name,
}}
>
<Skeleton.Avatar shape={'square'} size={24} style={{ marginInline: 8 }} />
<Skeleton height={16} width={'60%'} />
</Flexbox>
<Flexbox style={{ flexShrink: 0, paddingInline: '0 24px' }} width={columnWidths.date}>
<Skeleton height={16} width={'80%'} />
</Flexbox>
{showUploader && (
<Flexbox
horizontal
align={'center'}
gap={8}
style={{ flexShrink: 0, paddingInline: '0 24px' }}
width={columnWidths.uploader}
>
<Skeleton.Avatar size={20} />
<Skeleton height={16} width={'70%'} />
</Flexbox>
)}
<Flexbox style={{ flexShrink: 0, paddingInline: '0 24px' }} width={columnWidths.size}>
<Skeleton height={16} width={'60%'} />
</Flexbox>
</Flexbox>
))}
</Flexbox>
);
};
export default ListViewSkeleton;