Skip to content

Commit 0ee8284

Browse files
committed
adding home page skeleton
1 parent 04c9c77 commit 0ee8284

4 files changed

Lines changed: 34 additions & 11 deletions

File tree

client/app/page.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ImageItem from "@/components/ImageItem";
66
import { LoaderCircle } from "lucide-react";
77
import Link from "next/link";
88
import { Masonry } from "react-plock";
9+
import { Skeleton } from "@/components/ui/skeleton";
910

1011
export interface ImageType {
1112
id: string;
@@ -80,16 +81,30 @@ export default function Home() {
8081
return () => window.removeEventListener("scroll", handleScroll);
8182
}, [handleScroll]);
8283

83-
// First load
8484
if (loading && page === 1) {
85+
const heights = [
86+
180, 260, 220, 300, 250, 109, 280, 230, 148, 190, 270, 197,
87+
];
88+
8589
return (
86-
<div className="grid place-items-center h-[calc(90vh-150px)] text-[#ffffff90]">
87-
<LoaderCircle className="animate-spin" size={32} />
90+
<div className="relative h-fit w-full">
91+
{/* Skeleton Masonry */}
92+
<div className="exs:columns-2 md:columns-3 lg:columns-4 exs:gap-2 sm:gap-5">
93+
{heights.map((h, i) => (
94+
<Skeleton
95+
key={i}
96+
className="exs:mb-3 sm:mb-5 break-inside-avoid w-full rounded-xl"
97+
style={{ height: `${h}px` }}
98+
/>
99+
))}
100+
</div>
101+
102+
{/* Gradient fade at bottom */}
103+
<div className="pointer-events-none absolute bottom-0 left-0 h-full w-full bg-gradient-to-t from-[#09090b] via-[#09090b90] to-transparent" />
88104
</div>
89105
);
90106
}
91107

92-
// No images
93108
if (!loading && data.length === 0) {
94109
return (
95110
<div className="grid place-items-center h-[calc(90vh-150px)] text-[#ffffff90]">

client/app/privacy/page.tsx

Lines changed: 0 additions & 5 deletions
This file was deleted.

client/app/styles/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
:root {
2424
--radius: 0.75rem;
25-
--background: oklch(0.141 0.005 285.823);
26-
--foreground: oklch(0.985 0 0);
25+
--background: #09090b;
26+
--foreground: #fafafa;
2727
--card: oklch(0.21 0.006 285.885);
2828
--card-foreground: oklch(0.985 0 0);
2929
--popover: oklch(0.21 0.006 285.885);

client/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 opacity-40 rounded-md", className)}
8+
{...props}
9+
/>
10+
)
11+
}
12+
13+
export { Skeleton }

0 commit comments

Comments
 (0)