Skip to content

Commit 7a82b81

Browse files
seojin-v6xNamJwong
authored andcommitted
✨ feat: release 브랜치에 Adsense 추가 (#401 cherry-pick)
1 parent d191c0b commit 7a82b81

File tree

11 files changed

+77
-20
lines changed

11 files changed

+77
-20
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"homepage": "https://naegasogaeseo-dev.kro.kr/",
66
"dependencies": {
77
"@craco/craco": "^6.4.3",
8+
"@ctrl/react-adsense": "1.6.0",
89
"@testing-library/jest-dom": "^5.14.1",
910
"@testing-library/react": "^12.0.0",
1011
"@testing-library/user-event": "^13.2.1",

public/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
/>
2626
<script src="https://developers.kakao.com/sdk/js/kakao.js"></script>
2727
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4DZZ8ZJJYS"></script>
28+
<script
29+
async
30+
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6625943874572956"
31+
crossorigin="anonymous"
32+
></script>
2833
<script>
2934
window.dataLayer = window.dataLayer || [];
3035
function gtag() {

src/application/utils/constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const isProduction = process.env.NODE_ENV === 'production';
1+
export const isProduction = process.env.NODE_ENV === 'production';
22
export const DOMAIN = isProduction ? 'https://naegasogaeseo-dev.kro.kr' : 'http://localhost:3000';
33

44
export const PAGES = { KEYWORD: 15, NOTICE: 15, PICK: 10, SEARCHED_USER: 16 };
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Adsense } from '@ctrl/react-adsense';
2+
import { isProduction } from '@utils/constant';
3+
import { StDummyAdvertiseBlock } from './style';
4+
5+
function GoogleAdsense() {
6+
if (!isProduction) {
7+
return <StDummyAdvertiseBlock />;
8+
}
9+
10+
return (
11+
<Adsense
12+
client="ca-pub-6625943874572956"
13+
slot="8554867589"
14+
layout="display"
15+
style={{ width: '100%', height: '50px', position: 'absolute', top: 0, left: 0 }}
16+
/>
17+
);
18+
}
19+
20+
export default GoogleAdsense;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { COLOR } from '@styles/common/color';
2+
import styled from 'styled-components';
3+
4+
export const StDummyAdvertiseBlock = styled.div`
5+
height: 50px;
6+
background-color: ${COLOR.WHITE};
7+
position: absolute;
8+
top: 0;
9+
left: 0;
10+
width: 100%;
11+
`;

src/presentation/pages/Neoga/Link/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export default function NeogaLink() {
6767
createdFormData && navigate(`/neoga/${createdFormData.formID}/detail/form`);
6868

6969
useEffect(() => {
70-
if (!(viewMode === VIEW_MODE.NEW || viewMode === VIEW_MODE.CREATED)) navigate('/');
70+
setIsCreated(true);
71+
// if (!(viewMode === VIEW_MODE.NEW || viewMode === VIEW_MODE.CREATED)) navigate('/');
7172
if (viewMode === VIEW_MODE.CREATED) createFormCode();
7273
}, []);
7374

src/presentation/pages/NeososeoForm/Finish/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ImgAnswerDone } from '@assets/images';
2+
import GoogleAdsense from '@components/GoogleAdsense';
23
import { useNavigate } from 'react-router-dom';
34
import { StButton } from '../style';
45
import { StBody, StNeososeoFinish } from './style';
@@ -8,6 +9,7 @@ function NeososeoFormFinish() {
89

910
return (
1011
<StNeososeoFinish>
12+
<GoogleAdsense />
1113
<StBody>
1214
<ImgAnswerDone />
1315
<div>답변이 전달되었어요</div>

src/presentation/pages/NeososeoForm/Finish/style.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,25 @@ import styled from 'styled-components';
55
export const StBody = styled.div`
66
display: flex;
77
flex-direction: column;
8+
justify-content: center;
89
align-items: center;
10+
padding-bottom: 2px;
11+
& > div:nth-child(2) {
12+
color: ${COLOR.GRAY_8};
13+
${FONT_STYLES.SB_20_TITLE}
14+
}
15+
& > div:nth-child(3) {
16+
margin-top: 8px;
17+
color: ${COLOR.GRAY_5};
18+
${FONT_STYLES.R_15_TITLE}
19+
}
920
`;
1021

1122
export const StNeososeoFinish = styled.div`
1223
height: 100vh;
1324
width: 100%;
14-
padding: 50px 20px;
25+
padding: 0 20px 50px 20px;
1526
display: grid;
1627
grid-template-rows: auto 58px;
17-
& > div:nth-child(1) {
18-
display: flex;
19-
flex-direction: column;
20-
justify-content: center;
21-
align-items: center;
22-
padding-bottom: 52px;
23-
& > div:nth-child(2) {
24-
color: ${COLOR.GRAY_8};
25-
${FONT_STYLES.SB_20_TITLE}
26-
}
27-
& > div:nth-child(3) {
28-
margin-top: 8px;
29-
color: ${COLOR.GRAY_5};
30-
${FONT_STYLES.R_15_TITLE}
31-
}
32-
}
28+
position: relative;
3329
`;

src/presentation/pages/NeososeoForm/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useParams, Outlet } from 'react-router-dom';
2+
import GoogleAdsense from '@components/GoogleAdsense';
23

34
import { useGetFormInfo } from '@hooks/queries/neososeo-form';
45
import { StNeososeoFormPage } from './style';
@@ -9,6 +10,7 @@ function NeososeoFormPage() {
910

1011
return (
1112
<StNeososeoFormPage>
13+
<GoogleAdsense />
1214
{!isLoading && neososeoFormData !== undefined && <Outlet context={{ neososeoFormData }} />}
1315
</StNeososeoFormPage>
1416
);

src/presentation/pages/NeososeoForm/style.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ export const StNeososeoFormPage = styled.div`
99
display: flex;
1010
flex-direction: column;
1111
position: relative;
12+
padding-top: 50px;
13+
position: relative;
14+
15+
& > *:first-child {
16+
padding: 0 20px;
17+
padding-top: 50px;
18+
}
1219
`;
1320

1421
export const StNeososeoTitle = styled.div`
@@ -77,7 +84,7 @@ export const StNeososeoFormLayout = styled.div`
7784
margin-bottom: 48px;
7885
& > div:nth-child(1) {
7986
padding-top: 22px;
80-
padding-bottom: 134px;
87+
padding-bottom: 84px;
8188
}
8289
& > div:nth-child(2) {
8390
display: flex;

0 commit comments

Comments
 (0)