import * as React from 'react'; import styled from 'styled-components'; import adImg from './img/degg.png' export interface AdProps { show: boolean; onClose?: Function; } const Wrapper = styled.div` position: fixed; top: 40px; width: 40%; left: 50%; transform: translateX(-50%); ` const Close = styled.a` position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; color: #FFF; :hover { color:orange } ` export default class HeaderAd extends React.Component { static defaultProps = { show: false } state = { show:this.props.show } handleClose = () => { const {onClose} = this.props; this.setState({ show: false }) onClose && onClose(); } render() { const {show} = this.state; return ( show ? : null ); } }