Skip to content

Commit d820db5

Browse files
committed
feat: enhance loading state with SiteHeader and Skeleton components
1 parent f92fe77 commit d820db5

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

src/app/plants/[id]/loading.tsx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { LoaderCircle } from 'lucide-react';
1+
import { SiteHeader } from '@/src/components/ui/site-header';
22
import { SiteFooter } from '@/src/components/ui/site-footer';
3+
import { Skeleton, SkeletonDetailContent } from '@/src/components/ui/skeleton';
34

45
export default function PlantDetailLoading() {
56
return (
@@ -10,11 +11,34 @@ export default function PlantDetailLoading() {
1011
<div className="absolute -bottom-20 -left-14 h-64 w-64 rounded-full bg-amber-100/50 blur-3xl pointer-events-none" aria-hidden="true" />
1112

1213
<div className="relative z-10 flex min-h-screen flex-col">
13-
<main className="flex flex-1 items-center justify-center px-4 sm:px-6">
14-
<div className="botanical-card inline-flex items-center gap-2 rounded-2xl px-4 py-3 text-sm text-slate-600">
15-
<LoaderCircle className="h-4 w-4 animate-spin" />
16-
Loading plant details...
17-
</div>
14+
<SiteHeader
15+
pathname="/plants"
16+
onGoHome={() => {}}
17+
onGoDirectory={() => {}}
18+
onGoBack={() => {}}
19+
backLabel="Back"
20+
activeNav="none"
21+
/>
22+
<main className="mx-auto flex w-full max-w-6xl flex-1 flex-col px-4 pb-8 pt-7 sm:px-6 sm:pb-10 sm:pt-9">
23+
{/* Skeleton header */}
24+
<header className="mb-7 grid gap-5 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end animate-fade-up motion-reduce:animate-none">
25+
<div>
26+
<Skeleton className="h-3 w-36 rounded-lg" />
27+
<Skeleton className="mt-3 h-12 w-72 rounded-xl sm:h-14" />
28+
<Skeleton className="mt-3 h-5 w-48 rounded-lg" />
29+
<div className="mt-4 flex flex-wrap items-center gap-2">
30+
<Skeleton className="h-7 w-28 rounded-full" />
31+
</div>
32+
</div>
33+
<div className="botanical-card w-full max-w-sm rounded-[1.6rem] p-4">
34+
<Skeleton className="h-3 w-28 rounded-lg" />
35+
<Skeleton className="mt-3 h-4 w-full rounded-lg" />
36+
<Skeleton className="mt-1.5 h-4 w-3/4 rounded-lg" />
37+
</div>
38+
</header>
39+
40+
{/* Skeleton content */}
41+
<SkeletonDetailContent />
1842
</main>
1943
<SiteFooter />
2044
</div>

0 commit comments

Comments
 (0)