@@ -8,22 +8,22 @@ type RelatedPostProps = {
8
8
} ;
9
9
function RelatedPost ( { type } : RelatedPostProps ) {
10
10
const [ visible , setVisible ] = useState ( true ) ;
11
- // useEffect(() => {
12
- // setTimeout(() => {
13
- // const width = window.innerWidth;
14
- // if (type === 'desktop' && width < 768) {
15
- // setVisible(false);
16
- // return;
17
- // }
18
- // if (type === 'mobile' && width >= 768) {
19
- // setVisible(false);
20
- // return;
21
- // }
22
- // setTimeout(() => {
23
- // (window.adsbygoogle = window.adsbygoogle || []).push({});
24
- // }, 100 );
25
- // }, 250);
26
- // }, [type]);
11
+ useEffect ( ( ) => {
12
+ setTimeout ( ( ) => {
13
+ const width = window . innerWidth ;
14
+ if ( type === 'desktop' && width < 768 ) {
15
+ setVisible ( false ) ;
16
+ return ;
17
+ }
18
+ if ( type === 'mobile' && width >= 768 ) {
19
+ setVisible ( false ) ;
20
+ return ;
21
+ }
22
+ setTimeout ( ( ) => {
23
+ ( window . adsbygoogle = window . adsbygoogle || [ ] ) . push ( { } ) ;
24
+ } , 500 ) ;
25
+ } , 250 ) ;
26
+ } , [ type ] ) ;
27
27
28
28
useEffect ( ( ) => {
29
29
detectAnyAdblocker ( ) . then ( ( detected : boolean ) => {
@@ -37,17 +37,31 @@ function RelatedPost({ type }: RelatedPostProps) {
37
37
38
38
return (
39
39
< Wrapper >
40
- < h4 > 관심 있을 만한 포스트</ h4 > (
41
- < ins
42
- className = "adsbygoogle"
43
- style = { { display : 'block' } }
44
- data-ad-format = "autorelaxed"
45
- data-ad-client = "ca-pub-5574866530496701"
46
- data-ad-slot = "4990574169"
47
- data-matched-content-ui-type = "image_stacked"
48
- data-matched-content-rows-num = "2"
49
- data-matched-content-columns-num = "3"
50
- > </ ins >
40
+ < h4 > 관심 있을 만한 포스트</ h4 >
41
+ { type === 'desktop' && (
42
+ < ins
43
+ className = "adsbygoogle"
44
+ style = { { display : 'block' } }
45
+ data-ad-format = "autorelaxed"
46
+ data-ad-client = "ca-pub-5574866530496701"
47
+ data-ad-slot = "4990574169"
48
+ data-matched-content-ui-type = "image_stacked"
49
+ data-matched-content-rows-num = "2"
50
+ data-matched-content-columns-num = "3"
51
+ > </ ins >
52
+ ) }
53
+ { type === 'mobile' && (
54
+ < ins
55
+ className = "adsbygoogle"
56
+ style = { { display : 'block' } }
57
+ data-ad-format = "autorelaxed"
58
+ data-ad-client = "ca-pub-5574866530496701"
59
+ data-ad-slot = "4990574169"
60
+ data-matched-content-ui-type = "image_stacked"
61
+ data-matched-content-rows-num = "6"
62
+ data-matched-content-columns-num = "1"
63
+ > </ ins >
64
+ ) }
51
65
</ Wrapper >
52
66
) ;
53
67
}
0 commit comments