feat: added size prop

This commit is contained in:
Junseo Park 2021-02-14 16:06:08 +09:00
parent b73a60a310
commit 7fbc37cf1f

View File

@ -1,12 +1,12 @@
import { useEffect } from 'react' import { useEffect } from 'react'
const Advertisement = (): JSX.Element => { const Advertisement = ({ size='short' }:AdvertisementProps): JSX.Element => {
useEffect(() => { useEffect(() => {
if(process.env.NODE_ENV === 'production') if(process.env.NODE_ENV === 'production')
window?.adsbygoogle?.push({}) window?.adsbygoogle?.push({})
}) })
return <div className={`z-0 mx-auto w-full text-center text-white ${process.env.NODE_ENV === 'production' ? '' : 'py-12 bg-gray-700'}`} style={{ height: '90px' }}> return <div className={`z-0 mx-auto w-full text-center text-white ${process.env.NODE_ENV === 'production' ? '' : 'py-12 bg-gray-700'}`} style={size === 'short' ? { height: '90px' } : { height: '330px'}}>
{ {
process.env.NODE_ENV === 'production' ? <ins process.env.NODE_ENV === 'production' ? <ins
className='adsbygoogle mb-5 w-full' className='adsbygoogle mb-5 w-full'
@ -26,4 +26,8 @@ declare global {
} } } }
} }
interface AdvertisementProps {
size?: 'short' | 'tall'
}
export default Advertisement export default Advertisement