Skip to content

Commit 581911c

Browse files
committed
Use Component and fix margin
1 parent b437a97 commit 581911c

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/containers/post/RelatedPostAd.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React, { useEffect } from 'react';
2+
interface Props {}
3+
4+
function RelatedPostAd(props: Props) {
5+
useEffect(() => {
6+
(window.adsbygoogle = window.adsbygoogle || []).push({});
7+
}, []);
8+
9+
return (
10+
<ins
11+
className="adsbygoogle"
12+
style={{ display: 'block' }}
13+
data-ad-format="fluid"
14+
data-ad-layout-key="-7q+de+1z+n+3"
15+
data-ad-client="ca-pub-5574866530496701"
16+
data-ad-slot="9497725960"
17+
></ins>
18+
);
19+
}
20+
21+
export default RelatedPostAd;

src/containers/post/RelatedPostsForGuest.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { userThumbnail } from '../../static/images';
1313
import { Link } from 'react-router-dom';
1414
import gtag from '../../lib/gtag';
1515
import optimizeImage from '../../lib/optimizeImage';
16+
import RelatedPostAd from './RelatedPostAd';
1617
// import { detectAnyAdblocker } from 'just-detect-adblock';
1718

1819
function RelatedPostsForGuest({
@@ -83,14 +84,7 @@ function RelatedPostsForGuest({
8384
</Item>
8485
) : (
8586
<Item>
86-
<ins
87-
className="adsbygoogle"
88-
style={{ display: 'block' }}
89-
data-ad-format="fluid"
90-
data-ad-layout-key="-7p+de+1x+n+9"
91-
data-ad-client="ca-pub-5574866530496701"
92-
data-ad-slot="9497725960"
93-
></ins>
87+
<RelatedPostAd />
9488
</Item>
9589
),
9690
)}
@@ -114,8 +108,8 @@ const Wrapper = styled(VelogResponsive)`
114108
`;
115109

116110
const Grid = styled.div`
117-
margin-left: -0.5rem;
118-
margin-right: -0.5rem;
111+
margin-left: -1rem;
112+
margin-right: -1rem;
119113
display: flex;
120114
flex-wrap: wrap;
121115
margin-top: 1.5rem;
@@ -124,8 +118,8 @@ const Grid = styled.div`
124118
const Item = styled.div`
125119
position: relative;
126120
width: 33.333%;
127-
padding-left: 0.5rem;
128-
padding-right: 0.5rem;
121+
padding-left: 0.25rem;
122+
padding-right: 0.25rem;
129123
padding-bottom: 2rem;
130124
${media.medium} {
131125
width: 50%;

0 commit comments

Comments
 (0)