import { jsx, css } from "@emotion/core";
import { Fragment } from "react";
import PropTypes from "prop-types";
import _ from "lodash";
import Collapsable from "../Collapsable/Collapsable";
export function Resource(_ref) {
  var section = _ref.section;
  return jsx(Fragment, null, jsx("h3", null, section.heading), jsx("ul", null, section.items.map(function (item) {
    return jsx("li", null, jsx("a", {
      href: item.link
    }, item.description));
  })));
}
Resource.propTypes = {
  section: PropTypes.shape({
    heading: PropTypes.string,
    items: PropTypes.arrayOf(PropTypes.shape({
      link: PropTypes.string,
      description: PropTypes.string
    }))
  })
};
export function MetadataQuestion(_ref2) {
  var item = _ref2.item;
  return _.has(item, "section") ? jsx("h3", null, item.section) : item.answer.length > 0 && jsx(Fragment, null, jsx("h4", null, item.question), jsx("p", null, item.answer));
}
MetadataQuestion.propTypes = {
  item: PropTypes.shape({
    question: PropTypes.string,
    answer: PropTypes.string
  })
};
export function CollapsableSection(_ref3) {
  var items = _ref3.items,
      collapseAfter = _ref3.collapseAfter;

  var beforeFold = _.slice(items, 0, collapseAfter);

  var afterFold = _.slice(items, collapseAfter);

  return (afterFold && afterFold.length) > 0 ? jsx(Collapsable, null, jsx(Collapsable.Section, null, beforeFold), jsx(Collapsable.Section, {
    hidden: true
  }, afterFold)) : jsx(Fragment, null, beforeFold);
}
CollapsableSection.propTypes = {
  items: PropTypes.arrayOf(PropTypes.node),
  collapseAfter: PropTypes.number
};