import React from 'react';

import { Wrapper, Bg, CloseImg } from './styled';

const EmbedComp: React.FC = () => {
  const handleClose = () => {
    const wrapper = document.getElementById('embed-wrapper') as HTMLElement;
    const embeds = document.getElementsByTagName('embed');
    if (embeds[0]) {
      wrapper.style.display = 'none';
      wrapper.removeChild(embeds[0]);
    }
  };

  return (
    <Wrapper id="embed-wrapper">
      <Bg />
      <CloseImg src="/icons/button_close.svg" onClick={handleClose} />
    </Wrapper>
  );
};

export default EmbedComp;
