"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.NoteBoxQuotation = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const NoteBoxQuotation = props => {
  const {
    author,
    children,
    citation,
    className
  } = props;
  const classes = (0, _classnames.default)('ds-c-note-box-quotation', className);
  const CaptionContent = () => {
    // We want to prioritize citations over authors, so if both are present only render the citation.
    if (citation) {
      return /*#__PURE__*/(0, _jsxRuntime.jsxs)("cite", {
        className: "ds-c-note-box-quotation--citation",
        children: [`\u2014`, " ", citation]
      });
    }
    // If citation is not present, but author is, render the author.
    if (author) {
      return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
        children: [`\u2014`, " ", author]
      });
    }
    if (process.env.NODE_ENV !== 'production') {
      if (!citation && !author) {
        console.warn(`[Warning]: You must include either an author prop or a citation prop on your NoteBoxQuotation component.`);
      }
    }
    return null;
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
    className: classes,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("blockquote", {
      className: "ds-c-note-box-quotation--blockquote",
      children: children
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)("figcaption", {
      className: "ds-c-note-box-quotation--caption",
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CaptionContent, {})
    })]
  });
};
exports.NoteBoxQuotation = NoteBoxQuotation;