import _keys from "lodash/fp/keys";
import _isUndefined from "lodash/fp/isUndefined";
import _getOr from "lodash/fp/getOr";
import _get from "lodash/fp/get";
import React from 'react';
import PropTypes from 'prop-types';
import { NovaLineToolsWrenchScrewdriver as MaintenanceIcon, NovaLineLeisureLeisurePartyPopper as FeatureIcon, NovaCompositionCoorpacademyListBullets3 as SurveyIcon } from '@coorpacademy/nova-icons';
import Button from '../../atom/button';
import Provider from '../../atom/provider';
import style from './style.css';
const ICONS = {
  feature: {
    icon: FeatureIcon,
    title: 'New Feature',
    color: '#3ec483'
  },
  maintenance: {
    icon: MaintenanceIcon,
    title: 'Maintenance',
    color: '#f73f52'
  },
  survey: {
    icon: SurveyIcon,
    title: 'Survey',
    color: '#01579b'
  }
};
const NotificationBanner = (props, context) => {
  const {
    skin
  } = context;
  const primaryColor = _getOr('#00B0FF', 'common.primary', skin);
  const whiteColor = _get('common.white', skin);
  const {
    type,
    message,
    acceptOnClick,
    acceptLabel,
    closeLabel,
    closeOnClick
  } = props;
  const {
    icon: Icon,
    title,
    color
  } = _get([type], ICONS);
  const handleOnClickAcceptButton = acceptOnClick;
  const handleOnClickCloseButton = closeOnClick;
  return /*#__PURE__*/React.createElement("div", {
    className: style.banner
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      background: color
    },
    className: style.circle
  }, /*#__PURE__*/React.createElement(Icon, {
    className: style.icon
  })), /*#__PURE__*/React.createElement("div", {
    className: style.text
  }, /*#__PURE__*/React.createElement("div", {
    className: style.title
  }, title), /*#__PURE__*/React.createElement("div", {
    "data-name": "notification-banner-message",
    className: style.message
  }, message)), /*#__PURE__*/React.createElement("div", {
    className: style.buttons
  }, /*#__PURE__*/React.createElement(Button, {
    type: "link",
    "data-name": "notification-banner-close-cta",
    className: style.close,
    submitValue: closeLabel,
    onClick: handleOnClickCloseButton,
    style: {
      backgroundColor: whiteColor,
      color: '#546e7a'
    }
  }), !_isUndefined(handleOnClickAcceptButton) ? /*#__PURE__*/React.createElement(Button, {
    type: "link",
    "data-name": "notification-banner-cta",
    className: style.button,
    submitValue: acceptLabel,
    onClick: handleOnClickAcceptButton,
    target: "_blank",
    style: {
      backgroundColor: primaryColor
    }
  }) : null));
};
NotificationBanner.contextTypes = {
  skin: Provider.childContextTypes.skin
};
NotificationBanner.propTypes = process.env.NODE_ENV !== "production" ? {
  type: PropTypes.oneOf(_keys(ICONS)).isRequired,
  message: PropTypes.string.isRequired,
  acceptOnClick: PropTypes.func,
  acceptLabel: PropTypes.string,
  closeLabel: PropTypes.string,
  closeOnClick: PropTypes.func
} : {};
export default NotificationBanner;
//# sourceMappingURL=index.js.map