-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* style: 중복 되어 있던 globalstyle 컴포넌트 삭제 * feat: 광고 시스템 코드 생성 * feat: 광고 컴포넌트에 에러 시 callback UI 적용 * feat: mypage 하단에 광고 배너 넣기 --------- Co-authored-by: Wang HoEun <[email protected]>
- Loading branch information
Showing
6 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useEffect, useRef } from 'react'; | ||
import KakaoAdCallback from './KakaoAdCallback'; | ||
|
||
const KakaoAd = () => { | ||
const scriptElement = useRef<HTMLDivElement>(null); | ||
|
||
// script 태그를 동적으로 추가 | ||
useEffect(() => { | ||
const script = document.createElement('script'); | ||
script.setAttribute('src', 'https://t1.daumcdn.net/kas/static/ba.min.js'); | ||
script.setAttribute('charset', 'utf-8'); | ||
|
||
script.setAttribute('async', 'true'); | ||
scriptElement.current?.appendChild(script); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
... | ||
<div ref={scriptElement}> | ||
<ins | ||
className='kakao_ad_area' | ||
style={{ display: 'none' }} | ||
data-ad-unit='DAN-ZAZ2jcyFWckRtcrp' | ||
data-ad-width='320' | ||
data-ad-height='50' | ||
data-ad-onfail={<KakaoAdCallback />} | ||
/> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default KakaoAd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const KakaoAdCallbackWrapper = styled.div` | ||
${({ theme }) => theme.mixin.flexCenter({})}; | ||
background-color: white; | ||
width: 100%; | ||
color: black; | ||
${({ theme: { fonts } }) => fonts.body_03}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as S from './KakaoAdCallback.style'; | ||
|
||
const KakaoAdCallback = () => { | ||
return <S.KakaoAdCallbackWrapper>광고가 생성 될 부분입니다.</S.KakaoAdCallbackWrapper>; | ||
}; | ||
|
||
export default KakaoAdCallback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters