Skip to content

Commit 0412083

Browse files
committed
feat: add loading skeleton component for articles page
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
1 parent dd8002d commit 0412083

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/app/(articles)/[slug]/loading.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Skeleton } from "@/components/ui/skeleton";
2+
3+
export default function Loading() {
4+
return (
5+
<div className="relative overflow-hidden py-12 lg:py-24">
6+
<div className="container mx-auto max-w-7xl px-8">
7+
<div className="max-w-2xl mx-auto">
8+
{/* Title */}
9+
<Skeleton className="h-9 w-3/4 mt-2 mb-8" />
10+
11+
{/* Article content */}
12+
<div className="prose space-y-4">
13+
<Skeleton className="h-4 w-full" />
14+
<Skeleton className="h-4 w-full" />
15+
<Skeleton className="h-4 w-3/4" />
16+
<Skeleton className="h-4 w-full" />
17+
<Skeleton className="h-4 w-full" />
18+
<Skeleton className="h-4 w-full" />
19+
<Skeleton className="h-4 w-3/4" />
20+
<Skeleton className="h-[400px] w-full rounded-lg mb-8" />
21+
<Skeleton className="h-4 w-full" />
22+
<Skeleton className="h-4 w-5/6" />
23+
<Skeleton className="h-4 w-full" />
24+
<Skeleton className="h-4 w-full" />
25+
<Skeleton className="h-4 w-4/5" />
26+
</div>
27+
</div>
28+
</div>
29+
</div>
30+
);
31+
}

src/components/ui/skeleton.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { cn } from "@/lib/utils"
2+
3+
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4+
return (
5+
<div
6+
data-slot="skeleton"
7+
className={cn("bg-accent animate-pulse rounded-md", className)}
8+
{...props}
9+
/>
10+
)
11+
}
12+
13+
export { Skeleton }

0 commit comments

Comments
 (0)