1
1
"use client" ;
2
2
3
- import { ReactNode } from "react" ;
3
+ import { ReactNode , useEffect , useState } from "react" ;
4
4
import { motion } from "framer-motion" ;
5
5
6
6
export function HeaderSection ( {
@@ -10,44 +10,57 @@ export function HeaderSection({
10
10
title : string ;
11
11
description : string ;
12
12
} ) {
13
+ const [ mounted , setMounted ] = useState ( false ) ;
14
+ useEffect ( ( ) => {
15
+ setMounted ( true ) ;
16
+ } , [ ] ) ;
17
+
13
18
return (
14
- < motion . section
15
- className = "space-y-2 sm:space-y-3 md:space-y-4"
16
- initial = { { opacity : 0 , y : 20 } }
17
- animate = { { opacity : 1 , y : 0 } }
18
- transition = { { duration : 0.2 , ease : "easeOut" } }
19
- >
20
- < motion . h1
21
- className = "text-lg sm:text-xl lg:text-2xl font-bold"
22
- initial = { { opacity : 0 } }
23
- animate = { { opacity : 1 } }
24
- transition = { { delay : 0.1 , duration : 0.2 } }
19
+ mounted && (
20
+ < motion . section
21
+ className = "space-y-2 sm:space-y-3 md:space-y-4"
22
+ initial = { { opacity : 0 , y : 20 } }
23
+ animate = { { opacity : 1 , y : 0 } }
24
+ transition = { { duration : 0.2 , ease : "easeOut" } }
25
25
>
26
- { title }
27
- </ motion . h1 >
28
- < motion . p
29
- className = "text-sm sm:text-base text-muted-foreground"
30
- initial = { { opacity : 0 } }
31
- animate = { { opacity : 1 } }
32
- transition = { { delay : 0.15 , duration : 0.2 } }
33
- >
34
- { description }
35
- </ motion . p >
36
- </ motion . section >
26
+ < motion . h1
27
+ className = "text-lg sm:text-xl lg:text-2xl font-bold"
28
+ initial = { { opacity : 0 } }
29
+ animate = { { opacity : 1 } }
30
+ transition = { { delay : 0.1 , duration : 0.2 } }
31
+ >
32
+ { title }
33
+ </ motion . h1 >
34
+ < motion . p
35
+ className = "text-sm sm:text-base text-muted-foreground"
36
+ initial = { { opacity : 0 } }
37
+ animate = { { opacity : 1 } }
38
+ transition = { { delay : 0.15 , duration : 0.2 } }
39
+ >
40
+ { description }
41
+ </ motion . p >
42
+ </ motion . section >
43
+ )
37
44
) ;
38
45
}
39
46
40
47
export function PostGrid ( { children } : { children : ReactNode } ) {
48
+ const [ mounted , setMounted ] = useState ( false ) ;
49
+ useEffect ( ( ) => {
50
+ setMounted ( true ) ;
51
+ } , [ ] ) ;
41
52
return (
42
- < motion . section
43
- initial = { { opacity : 0 } }
44
- animate = { { opacity : 1 } }
45
- transition = { { delay : 0.2 , duration : 0.2 } }
46
- >
47
- < div className = "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5" >
48
- { children }
49
- </ div >
50
- </ motion . section >
53
+ mounted && (
54
+ < motion . section
55
+ initial = { { opacity : 0 } }
56
+ animate = { { opacity : 1 } }
57
+ transition = { { delay : 0.2 , duration : 0.2 } }
58
+ >
59
+ < div className = "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5" >
60
+ { children }
61
+ </ div >
62
+ </ motion . section >
63
+ )
51
64
) ;
52
65
}
53
66
0 commit comments