"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactRouter = require("react-router");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var CardDetailPageEmbed = function CardDetailPageEmbed(_ref) {
  var params = _ref.params,
      CardRegistry = _ref.CardRegistry;
  var card = CardRegistry.find(params.slug);

  if (card && card.component) {
    var CardComponent = card.component;
    return _react["default"].createElement(CardComponent, null);
  }

  return _react["default"].createElement("div", null, _react["default"].createElement("h1", null, "Card not found"), _react["default"].createElement("p", null, "The card you are looking for doesn't exist."), _react["default"].createElement(_reactRouter.Link, {
    to: "/"
  }, "Find more on CIVIC"));
};

CardDetailPageEmbed.propTypes = {
  params: _propTypes["default"].shape({
    slug: _propTypes["default"].string.isRequired
  }),
  CardRegistry: _propTypes["default"].shape({
    entries: _propTypes["default"].arrayOf(_propTypes["default"].shape({
      component: _propTypes["default"].func.isRequired,
      project: _propTypes["default"].string.isRequired,
      slug: _propTypes["default"].string.isRequired
    }))
  }).isRequired
};
CardDetailPageEmbed.displayName = "CardDetailPageEmbed";
var _default = CardDetailPageEmbed;
exports["default"] = _default;