-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
profile screen skeleton loader (#2438)
* add profile skeleton loader * fix navbar jump bug * add multi shimmer skeleton * fix prettier unused field * fix prettier * improve multishimmer context and mobile skeleton
- Loading branch information
1 parent
4efa9d6
commit f77743d
Showing
8 changed files
with
280 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import Skeleton from 'react-loading-skeleton'; | ||
import styled from 'styled-components'; | ||
|
||
import { size } from '../core/breakpoints'; | ||
|
||
const Wrapper = styled.div` | ||
margin-bottom: 60px; | ||
width: 100%; | ||
`; | ||
|
||
const ArtworksGridSkeleton = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
grid-gap: 16px; | ||
margin-top: 16px; | ||
@media (max-width: ${size.tablet}px) { | ||
// Adjusts to a mobile viewport | ||
grid-template-columns: repeat(1, 1fr); | ||
} | ||
`; | ||
|
||
const ArtworkGridItemSkeleton = styled(Skeleton)` | ||
height: 300px; | ||
`; | ||
|
||
const SkeletoState = () => { | ||
return ( | ||
<Wrapper> | ||
<ArtworksGridSkeleton> | ||
{[...Array(12)].map((_, index) => ( | ||
<ArtworkGridItemSkeleton key={index} /> | ||
))} | ||
</ArtworksGridSkeleton> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export function MultiShimmer() { | ||
return <SkeletoState />; | ||
} |
87 changes: 87 additions & 0 deletions
87
apps/web/src/components/Profile/ProfileScreenLoadingSkeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React from 'react'; | ||
import Skeleton from 'react-loading-skeleton'; | ||
import styled from 'styled-components'; | ||
|
||
import { GalleryPageSpacing } from '~/pages/[username]'; | ||
|
||
import { size } from '../core/breakpoints'; | ||
import { VStack } from '../core/Spacer/Stack'; | ||
|
||
const GallerySkeletonWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
const Wrapper = styled.div` | ||
padding-left: 20px; | ||
padding-right: 20px; | ||
margin-bottom: 60px; | ||
`; | ||
|
||
const TitleSkeleton = styled(Skeleton)` | ||
margin-top: 20px; | ||
width: 15vw; | ||
height: 2vh; | ||
`; | ||
|
||
const UsernameSkeleton = styled(Skeleton)` | ||
margin-top: 10px; | ||
width: 15vw; | ||
height: 2vh; | ||
`; | ||
|
||
const UsernameFollowsSkeleton = styled(Skeleton)` | ||
margin-top: 18px; | ||
width: 20vw; | ||
height: 2vh; | ||
`; | ||
|
||
const UsernameSocialsSkeleton = styled(Skeleton)` | ||
margin-top: 10px; | ||
width: 10vw; | ||
height: 2vh; | ||
`; | ||
|
||
const ArtworksGridSkeleton = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); // default to 4 items per row | ||
grid-gap: 16px; | ||
margin-top: 16px; | ||
@media (max-width: ${size.tablet}px) { | ||
// Adjusts to a mobile viewport | ||
grid-template-columns: repeat(1, 1fr); // 1 item per row on mobile | ||
} | ||
`; | ||
|
||
const ArtworkGridItemSkeleton = styled(Skeleton)` | ||
height: 300px; | ||
`; | ||
|
||
const UserGallerySkeleton = () => { | ||
return ( | ||
<GalleryPageSpacing> | ||
<VStack> | ||
<GallerySkeletonWrapper> | ||
<Wrapper> | ||
<UsernameSkeleton /> | ||
<UsernameFollowsSkeleton /> | ||
<UsernameSocialsSkeleton /> | ||
</Wrapper> | ||
</GallerySkeletonWrapper> | ||
</VStack> | ||
<Wrapper> | ||
<TitleSkeleton /> | ||
<ArtworksGridSkeleton> | ||
{[...Array(12)].map((_, index) => ( | ||
<ArtworkGridItemSkeleton key={index} /> | ||
))} | ||
</ArtworksGridSkeleton> | ||
</Wrapper> | ||
</GalleryPageSpacing> | ||
); | ||
}; | ||
|
||
export function ProfileScreenLoadingSkeleton() { | ||
return <UserGallerySkeleton />; | ||
} |
2 changes: 1 addition & 1 deletion
2
apps/web/src/contexts/globalLayout/GlobalNavbar/useGlobalNavbarHeight.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.