Skip to content

Commit

Permalink
feat: add table skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jan 24, 2024
1 parent c299a9b commit 573ee54
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/leaderboard/common/LeaderboardTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export default function LeaderboardTable({ role, ...props }: LeaderboardTablePro
<span>Staker</span>
<span>Rewards this week</span>
</div>
{slicedData.length === 0 &&
Array.from({ length: 3 }).map((_, idx) => <UserRowSkeleton key={idx} />)}
{slicedData.map(row => (
<UserRow role={role} key={row.rank} data={row} loading={!!loading} />
))}
Expand All @@ -79,6 +81,21 @@ export default function LeaderboardTable({ role, ...props }: LeaderboardTablePro
)
}

function UserRowSkeleton() {
return (
<a className={clsx(styles.LeaderboardRow)}>
<SpanSkeleton style={{ width: '2ch' }} />
<div className='d-flex align-items-center' style={{ minWidth: 0 }}>
<Skeleton.Avatar size={32} className='mr-1' />
<SpanSkeleton />
</div>
<span style={{ textAlign: 'right' }}>
<SpanSkeleton />
</span>
</a>
)
}

function UserRow({
data,
loading,
Expand Down

0 comments on commit 573ee54

Please sign in to comment.