Skip to content

Commit

Permalink
feat(attendanceRequests): add skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
simon0820s committed Dec 16, 2024
1 parent be9a294 commit 99db8b8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
import { Card, CardContent, Skeleton, Stack } from '@mui/material'
import React from 'react'

export default function AttendanceRequestSkeleton() {
return <div>index</div>
export default function AttendanceRequestCardSkeleton() {
return (
<Card>
<CardContent sx={{ paddingLeft: '36px', paddingRight: '44px' }}>
<Stack direction="row" justifyContent="space-between" alignItems="center" width="100%">
<Stack direction="row" gap="32px" alignItems="center">
<Skeleton variant="circular" height={32} width={32} />
<Stack gap="10px">
<Skeleton height={32} width={120} />
<div style={{ display: 'grid', gap: '10px', gridTemplateColumns: 'auto 1fr' }}>
<Skeleton height={12} width={80} />
<Skeleton height={12} width={60} />
<Skeleton height={12} width={80} />
<Skeleton height={12} width={60} />
</div>
</Stack>
</Stack>
<Skeleton variant="circular" height={32} width={32} />
</Stack>
</CardContent>
</Card>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { type AttendanceRequest } from '@/types/activities'
import AttendanceRequestCard from '@/components/activities/Payout/AttendanceRequests/Card'
import Link from 'next/link'
import { type ReactNode } from 'react'
import AttendanceRequestCardSkeleton from '../Card/Skeleton'

type Props = {
requests: AttendanceRequest[]
Expand All @@ -14,13 +15,32 @@ type Props = {
}

export default function AttendanceRequestsSelectionCard({ requests, setRequests, children }: Props) {
if (!requests)
if (requests.length == 0)
return (
<ItemsCard title="My Activities">
{Array.from({ length: 3 }).map((_, index) => (
<ItemsCard
title="Attendee"
headerAction={
<>
<Typography variant="body1" color="#7E7E7E" sx={{ marginRight: '24px', paddingTop: '6px' }}>
Select
</Typography>
</>
}
actions={
<>
<Link href="/activities">
<Button>Go Back</Button>
</Link>
{children}
</>
}
>
{Array.from({ length: 2 })?.map((_, index) => (
<Box key={index}>
<Divider />
<Box paddingLeft={4}></Box>
<CardContent>
<AttendanceRequestCardSkeleton />
</CardContent>
</Box>
))}
</ItemsCard>
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/signin/EmailForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const EmailForm = (): ReactElement => {
formState: { errors, isValid },
} = useForm({
resolver: zodResolver(formSignInSchema),
mode: 'all',
mode: 'onTouched',
})

useEffect(() => {
Expand Down

0 comments on commit 99db8b8

Please sign in to comment.