Skip to content

Commit 3374fe7

Browse files
committed
Trying to fix bug in mobile
1 parent 32ed12f commit 3374fe7

File tree

2 files changed

+30
-40
lines changed

2 files changed

+30
-40
lines changed

src/containers/post/PostViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ const PostViewer: React.FC<PostViewerProps> = ({
373373
comments={post.comments}
374374
postId={post.id}
375375
/>
376-
<RelatedPost type="mobile" />
376+
{/* <RelatedPost type="mobile" /> */}
377377
</PostViewerProvider>
378378
);
379379
};

src/containers/post/RelatedPost.tsx

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ type RelatedPostProps = {
88
};
99
function RelatedPost({ type }: RelatedPostProps) {
1010
const [visible, setVisible] = useState(true);
11-
useEffect(() => {
12-
const width = window.innerWidth;
13-
if (type === 'desktop' && width < 768) {
14-
setVisible(false);
15-
return;
16-
}
17-
if (type === 'mobile' && width >= 768) {
18-
setVisible(false);
19-
return;
20-
}
21-
setTimeout(() => {
22-
(window.adsbygoogle = window.adsbygoogle || []).push({});
23-
}, 100);
24-
}, [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+
// }, 100);
25+
// }, 250);
26+
// }, [type]);
2527

2628
useEffect(() => {
2729
detectAnyAdblocker().then((detected: boolean) => {
@@ -35,36 +37,24 @@ function RelatedPost({ type }: RelatedPostProps) {
3537

3638
return (
3739
<Wrapper>
38-
<h4>관심 있을 만한 포스트</h4>
39-
{type === 'desktop' && (
40-
<ins
41-
className="adsbygoogle"
42-
style={{ display: 'block' }}
43-
data-ad-format="autorelaxed"
44-
data-ad-client="ca-pub-5574866530496701"
45-
data-ad-slot="4990574169"
46-
data-matched-content-ui-type="image_stacked"
47-
data-matched-content-rows-num="2"
48-
data-matched-content-columns-num="3"
49-
></ins>
50-
)}
51-
{type === 'mobile' && (
52-
<ins
53-
className="adsbygoogle"
54-
style={{ display: 'block' }}
55-
data-ad-format="autorelaxed"
56-
data-ad-client="ca-pub-5574866530496701"
57-
data-ad-slot="4990574169"
58-
data-matched-content-ui-type="image_stacked"
59-
data-matched-content-rows-num="6"
60-
data-matched-content-columns-num="1"
61-
></ins>
62-
)}
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>
6351
</Wrapper>
6452
);
6553
}
6654

6755
const Wrapper = styled(VelogResponsive)`
56+
padding-left: 1rem;
57+
padding-right: 1rem;
6858
margin-top: 4rem;
6959
margin-bottom: 3rem;
7060
`;

0 commit comments

Comments
 (0)