Skip to content

Commit 0eb4d0a

Browse files
committed
Feat: 로딩 화면 추가
1 parent eb1c363 commit 0eb4d0a

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

app/(blog)/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export default async function Home() {
99
return (
1010
<div className="space-y-6 sm:space-y-8 2xl:space-y-10 h-full rounded-lg p-1 sm:p-7">
1111
{/* 헤더 섹션 */}
12-
<HeaderSection
13-
title="Lazydino's DevLog"
14-
description="내가 한걸 티내기 위해 만든 블로그"
12+
<HeaderSection
13+
title="Lazydino's DevLog"
14+
description="내가 한걸 티내기 위해 만든 블로그"
1515
/>
1616

1717
{/* 포스트 그리드 */}
@@ -33,4 +33,4 @@ export default async function Home() {
3333
</PostGrid>
3434
</div>
3535
);
36-
}
36+
}

components/home-animation.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,29 @@
33
import { ReactNode } from "react";
44
import { motion } from "framer-motion";
55

6-
export function HeaderSection({ title, description }: { title: string; description: string }) {
6+
export function HeaderSection({
7+
title,
8+
description,
9+
}: {
10+
title: string;
11+
description: string;
12+
}) {
713
return (
8-
<motion.section
14+
<motion.section
915
className="space-y-2 sm:space-y-3 md:space-y-4"
1016
initial={{ opacity: 0, y: 20 }}
1117
animate={{ opacity: 1, y: 0 }}
1218
transition={{ duration: 0.2, ease: "easeOut" }}
1319
>
14-
<motion.h1
20+
<motion.h1
1521
className="text-lg sm:text-xl lg:text-2xl font-bold"
1622
initial={{ opacity: 0 }}
1723
animate={{ opacity: 1 }}
1824
transition={{ delay: 0.1, duration: 0.2 }}
1925
>
2026
{title}
2127
</motion.h1>
22-
<motion.p
28+
<motion.p
2329
className="text-sm sm:text-base text-muted-foreground"
2430
initial={{ opacity: 0 }}
2531
animate={{ opacity: 1 }}
@@ -45,18 +51,24 @@ export function PostGrid({ children }: { children: ReactNode }) {
4551
);
4652
}
4753

48-
export function PostItem({ children, index }: { children: ReactNode; index: number }) {
54+
export function PostItem({
55+
children,
56+
index,
57+
}: {
58+
children: ReactNode;
59+
index: number;
60+
}) {
4961
return (
5062
<motion.div
5163
initial={{ opacity: 0, y: 20 }}
5264
animate={{ opacity: 1, y: 0 }}
53-
transition={{
65+
transition={{
5466
delay: 0.05 * (index % 3) + 0.25,
5567
duration: 0.2,
56-
ease: "easeOut"
68+
ease: "easeOut",
5769
}}
5870
>
5971
{children}
6072
</motion.div>
6173
);
62-
}
74+
}

components/post-animation.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { ReactNode } from "react";
3+
import { ReactNode, useEffect, useState } from "react";
44
import { motion } from "framer-motion";
55
import Link from "next/link";
66
import { ArrowLeft } from "lucide-react";
@@ -15,15 +15,21 @@ import { ArrowLeft } from "lucide-react";
1515
// }
1616

1717
export default function PostAnimation({ children }: { children: ReactNode }) {
18+
const [mounted, setMounted] = useState(false);
19+
useEffect(() => {
20+
setMounted(true);
21+
}, []);
1822
return (
19-
<motion.article
20-
className="rounded-lg p-2 sm:p-7 max-w-3xl mx-auto"
21-
initial={{ opacity: 0, y: 20 }}
22-
animate={{ opacity: 1, y: 0 }}
23-
transition={{ duration: 0.2, ease: "easeOut" }}
24-
>
25-
{children}
26-
</motion.article>
23+
mounted && (
24+
<motion.article
25+
className="rounded-lg p-2 sm:p-7 max-w-3xl mx-auto"
26+
initial={{ opacity: 0, y: 20 }}
27+
animate={{ opacity: 1, y: 0 }}
28+
transition={{ duration: 0.2, ease: "easeOut" }}
29+
>
30+
{children}
31+
</motion.article>
32+
)
2733
);
2834
}
2935

0 commit comments

Comments
 (0)