Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add skeleton to loadings #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/app/events/[event]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,33 @@ export default function Event({ params }: EventProps) {
}

if (eventQuery.isLoading) {
return <p>Carregando dados do evento...</p>
return (
<main className="animate-pulse pb-8">
<div className="mb-8 flex justify-between">
<div className="h-[30px] w-[233px] rounded-[4px] bg-neutral-200" />
<nav>
<div className="flex gap-3">
<div className="group relative flex w-[247px] gap-2 overflow-hidden">
<div className="h-[40px] w-[150px] rounded-[4px] bg-neutral-200" />
<div className="h-[40px] w-[150px] rounded-[4px] bg-neutral-200" />
</div>
</div>
</nav>
</div>
<div className="mb-2 flex items-center justify-between">
<div className="flex items-center gap-2">
<div className="h-[34px] w-[210px] rounded-[4px] bg-neutral-200" />
<div>
<div className="flex h-[34px] w-[210px] gap-1 rounded-[4px] bg-neutral-200" />
</div>
</div>
<div>
<div className="h-[34px] w-[210px] rounded-[4px] bg-neutral-200" />
</div>
</div>
<div className="min-h-screen min-w-full rounded-[4px] bg-neutral-200" />
</main>
)
}

return (
Expand Down
21 changes: 20 additions & 1 deletion src/app/events/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ export default function Events() {
registerEventMutation.mutate(data)
}

if (eventsQuery.isLoading) {
return (
<main className="animate-pulse pb-8">
<div className="mb-4 flex justify-between">
<div className="h-[35px] w-[140px] rounded-[4px] bg-neutral-200" />

<div>
<div className="h-[45px] w-[130px] rounded-[4px] bg-neutral-200" />
</div>
</div>

<div className="grid grid-cols-3 gap-2">
<div className="h-[87px] w-[300px] rounded-[8px] bg-neutral-200" />
<div className="h-[87px] w-[300px] rounded-[8px] bg-neutral-200" />
<div className="h-[87px] w-[300px] rounded-[8px] bg-neutral-200" />
</div>
</main>
)
}

return (
<div className="flex flex-col justify-between gap-4 font-sans text-neutral-900">
<div className="flex items-center justify-between">
Expand All @@ -48,7 +68,6 @@ export default function Events() {
/>
</div>
<div className="grid grid-cols-3 gap-2">
{eventsQuery.isLoading && <p>Carregando eventos...</p>}
{events.length === 0 && eventsQuery.isSuccess && (
<p>Nenhum evento cadastrado.</p>
)}
Expand Down