"use strict";

exports.__esModule = true;
exports.default = void 0;
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _link = _interopRequireDefault(require("../../atom/link"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const PDF = (props, context) => {
  const {
    description,
    mediaUrl,
    poster,
    onPlay
  } = props;
  const {
    translate,
    skin
  } = context;
  const white = (0, _get2.default)('common.white', skin);
  const primary = (0, _get2.default)('common.primary', skin);
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.pdfFrame,
    style: {
      backgroundImage: `url(${poster})`
    }
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaLineFilesOfficeFileOfficePdf, {
    style: {
      color: white
    },
    className: _style.default.pdfIcon
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _classnames.default)(_style.default.pdfDescription, _style.default.innerHTML),
    "data-name": "pdfDescription"
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: description
    }
  }), /*#__PURE__*/_react.default.createElement(_link.default, {
    href: mediaUrl,
    target: "_blank",
    onClick: onPlay
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.openPDFButton
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.openPDFButtonBackground,
    style: {
      backgroundColor: primary
    }
  }), /*#__PURE__*/_react.default.createElement("label", {
    className: _style.default.openPDFButtonLabel
  }, translate('Open')))));
};
PDF.contextTypes = {
  translate: _provider.default.childContextTypes.translate,
  skin: _provider.default.childContextTypes.skin
};
PDF.propTypes = process.env.NODE_ENV !== "production" ? {
  description: _propTypes.default.string,
  mediaUrl: _propTypes.default.string,
  poster: _propTypes.default.string,
  onPlay: _propTypes.default.func
} : {};
var _default = exports.default = PDF;
//# sourceMappingURL=index.js.map