Skip to content

Commit

Permalink
upd skeleton for cards
Browse files Browse the repository at this point in the history
  • Loading branch information
lukachi committed Mar 26, 2024
1 parent fd34fb7 commit 377103d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Divider, Skeleton, Stack, StackProps } from '@mui/material'

import { UiIcon } from '@/ui'

type Props = StackProps

export default function VotingListCard({ ...rest }: Props) {
return (
<Stack {...rest} spacing={6}>
<Stack spacing={2}>
<Skeleton width={48} />
<Skeleton />
<Skeleton />
</Stack>

<Divider />

<Stack
width='100%'
direction='row'
alignItems='center'
justifyContent='space-between'
spacing={2}
>
<Stack direction='row' spacing={2} alignItems='center'>
<UiIcon componentName='calendarMonth' size={4} />
<Skeleton width={24} />
</Stack>
</Stack>
</Stack>
)
}
1 change: 1 addition & 0 deletions src/pages/Votings/pages/VotingsList/components/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as VotingListCard } from './VotingListCard'
export { default as VotingListCardSkeleton } from './VotingListCardSkeleton'
20 changes: 10 additions & 10 deletions src/pages/Votings/pages/VotingsList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Alert, Box, Grid, Paper, Skeleton, Stack } from '@mui/material'
import { Alert, Paper, Stack } from '@mui/material'

import { NoDataViewer, PageTitles } from '@/common'
import { useVotingsContext } from '@/pages/Votings/contexts'

import { VotingListCard } from './components'
import { VotingListCard, VotingListCardSkeleton } from './components'

export default function VotingsList() {
const { AppVotings, isVotingsLoading, isVotingsLoadingError } = useVotingsContext()
Expand All @@ -13,14 +13,14 @@ export default function VotingsList() {
<PageTitles title={'Active Polls'} />

{isVotingsLoading ? (
<Grid container spacing={4}>
<Box component={Grid} item xs={6}>
<Skeleton height={360} />
</Box>
<Box component={Grid} item xs={6}>
<Skeleton height={360} />
</Box>
</Grid>
<Stack mt={6} spacing={6}>
<Paper>
<VotingListCardSkeleton />
</Paper>
<Paper>
<VotingListCardSkeleton />
</Paper>
</Stack>
) : isVotingsLoadingError ? (
<Alert severity='error'>{`There's an error occurred, please, reload page`}</Alert>
) : AppVotings.length ? (
Expand Down

0 comments on commit 377103d

Please sign in to comment.