Skip to content

Commit

Permalink
[fix] 아직 의도보다 광고가 좀 작게 나오긴 하지만.. 일단 퇴근 #458
Browse files Browse the repository at this point in the history
  • Loading branch information
triplecheeseburger committed Aug 11, 2023
1 parent cef089a commit 28baf8d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 34 deletions.
59 changes: 25 additions & 34 deletions components/global/GoogleAd.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,48 @@
import React, { useEffect } from 'react';

import styles from 'styles/global/GoogleAd.module.scss';

export default function GoogleAd({
className = 'adsbygoogle',
client = '',
slot = '',
format = '',
}: {
className?: string;
client?: string;
slot?: string;
format?: string;
}) {
useEffect(() => {
// if (process.env.NODE_ENV !== 'production') return;
if (process.env.NODE_ENV !== 'production') return;
window.onload = () => {
((window as any).adsbygoogle = (window as any).adsbygoogle || []).push(
{}
);
};
}, []);

// if (process.env.NODE_ENV !== 'production')
// return (
// <div
// style={{
// background: '#e9e9e9',
// color: 'black',
// fontSize: '18px',
// fontWeight: 'bold',
// textAlign: 'center',
// padding: '16px',
// margin: '0',
// }}
// >
// 광고 표시 영역
// </div>
// );

const style = {
display: 'block',
width: format === 'horizontal' ? 'auto' : '160px',
height: format === 'horizontal' ? '100px' : 'auto',
};
if (process.env.NODE_ENV !== 'production')
return (
<div
style={{
background: '#e9e9e9',
color: 'black',
fontSize: '18px',
fontWeight: 'bold',
textAlign: 'center',
padding: '16px',
margin: '0',
}}
>
광고 표시 영역
</div>
);

return (
<div>
<ins
className={className}
style={style}
data-ad-client={client}
data-ad-slot={slot}
data-ad-format={format}
/>
</div>
<ins
className={styles[format]}
data-ad-client={client}
data-ad-slot={slot}
data-ad-format={format}
/>
);
}
11 changes: 11 additions & 0 deletions styles/global/GoogleAd.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.horizontal {
display: block;
width: 100%;
height: 100px;
}

.vertical {
display: block;
width: 160px;
height: 100%;
}

0 comments on commit 28baf8d

Please sign in to comment.