File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useEffect , useState } from 'react' ;
2
2
import styled from 'styled-components' ;
3
3
import VelogResponsive from '../../components/velog/VelogResponsive' ;
4
+ import { detectAnyAdblocker } from 'just-detect-adblock' ;
4
5
5
6
type RelatedPostProps = {
6
7
type : 'desktop' | 'mobile' ;
@@ -20,10 +21,19 @@ function RelatedPost({ type }: RelatedPostProps) {
20
21
( window . adsbygoogle = window . adsbygoogle || [ ] ) . push ( { } ) ;
21
22
} , [ type ] ) ;
22
23
24
+ useEffect ( ( ) => {
25
+ detectAnyAdblocker ( ) . then ( ( detected : boolean ) => {
26
+ if ( detected ) {
27
+ setVisible ( false ) ;
28
+ }
29
+ } ) ;
30
+ } , [ ] ) ;
31
+
23
32
if ( ! visible ) return null ;
24
33
25
34
return (
26
35
< Wrapper >
36
+ < h4 > 관심 있을 만한 포스트</ h4 >
27
37
< ins
28
38
className = "adsbygoogle"
29
39
style = { { display : 'block' } }
@@ -36,8 +46,8 @@ function RelatedPost({ type }: RelatedPostProps) {
36
46
}
37
47
38
48
const Wrapper = styled ( VelogResponsive ) `
39
- margin-top: 2rem ;
40
- margin-bottom: 2rem ;
49
+ margin-top: 4rem ;
50
+ margin-bottom: 3rem ;
41
51
` ;
42
52
43
53
export default RelatedPost ;
You can’t perform that action at this time.
0 commit comments