import React from 'react';
import PropTypes from 'prop-types';
import { NovaCompositionCoorpacademyReload as ReloadIcon, NovaCompositionCoorpacademyLoginFailed as LoginFailedIcon, NovaCompositionCoorpacademyAddressError as AddressErrorIcon, NovaCompositionCoorpacademySchoolGraduation as SchoolGraduation } from '@coorpacademy/nova-icons';
import Cta from '../../atom/cta';
import Loader from '../../atom/loader';
import style from './style.css';
const ICONS = {
  login: SchoolGraduation,
  loginFailed: LoginFailedIcon,
  addressError: AddressErrorIcon,
  reload: ReloadIcon,
  wrong: ReloadIcon
};
const TeamsPopin = props => {
  const {
    header,
    content,
    buttonLabel,
    aboutLabel,
    onButtonClick,
    type,
    isLoading = false,
    backgroundImageUrl
  } = props;
  const IconType = ICONS[type];
  const iconContainerStyle = type === 'login' ? style.iconContainer : style.errorIconContainer;
  const Icon = IconType ? /*#__PURE__*/React.createElement("div", {
    className: iconContainerStyle
  }, /*#__PURE__*/React.createElement(IconType, {
    className: style.icon
  })) : null;
  const backgroundImageStyle = backgroundImageUrl ? {
    backgroundImage: `url(${backgroundImageUrl})`,
    backgroundSize: 'cover'
  } : {};
  return /*#__PURE__*/React.createElement("div", {
    className: style.background,
    style: backgroundImageStyle
  }, isLoading ? /*#__PURE__*/React.createElement("div", {
    className: style.loader
  }, /*#__PURE__*/React.createElement(Loader, {
    "data-name": "teams-popin-loader"
  })) : /*#__PURE__*/React.createElement("div", {
    className: style.popin
  }, Icon, /*#__PURE__*/React.createElement("div", {
    className: style.header,
    "data-name": `popin-header-${type}` // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: header
    }
  }), /*#__PURE__*/React.createElement("p", {
    className: style.content,
    "data-name": `popin-content-${type}` // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: content
    }
  }), buttonLabel && onButtonClick ? /*#__PURE__*/React.createElement("div", {
    className: style.buttonContainer
  }, /*#__PURE__*/React.createElement(Cta, {
    submitValue: buttonLabel,
    onClick: onButtonClick,
    name: `popin-cta-${type}`
  })) : null, aboutLabel ? /*#__PURE__*/React.createElement("p", {
    className: style.about,
    "data-name": `popin-about-label-${type}` // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: aboutLabel
    }
  }) : null));
};
TeamsPopin.propTypes = process.env.NODE_ENV !== "production" ? {
  header: PropTypes.string,
  content: PropTypes.string,
  buttonLabel: PropTypes.string,
  aboutLabel: PropTypes.string,
  onButtonClick: PropTypes.func,
  type: PropTypes.oneOf(['login', 'reload', 'loginFailed', 'addressError', 'wrong']),
  isLoading: PropTypes.bool,
  backgroundImageUrl: PropTypes.string
} : {};
export default TeamsPopin;
//# sourceMappingURL=index.js.map