Skip to content

Commit

Permalink
Develop createListSkeleton JC-718
Browse files Browse the repository at this point in the history
  • Loading branch information
manpham-saritasa committed Aug 27, 2024
1 parent 646679e commit 0b58013
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ const StudiosListComponent: FC = () => {
[nextCursor],
);

/** Create skeletons for list. */
function createListSkeleton(): JSX.Element[] {
return Array.from(new Array(10)).map((_, index) => <ListItemSkeleton key={index} />);
}

return (
<Box
component='section'
Expand All @@ -70,9 +75,7 @@ const StudiosListComponent: FC = () => {
}}
>
<List disablePadding>
{isLoading &&
studiosList.length === 0 &&
Array.from(new Array(10)).map((_, index) => <ListItemSkeleton key={index} />)}
{isLoading && studiosList.length === 0 && createListSkeleton()}

{studiosList.map((studio, index) => {
if (studiosList.length === index + 1) {
Expand Down

0 comments on commit 0b58013

Please sign in to comment.