"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");

var _ = require("../..");

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

var CardDetailPage = function CardDetailPage(_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(_.PageLayout, null, _react["default"].createElement(CardComponent, null));
  }

  return _react["default"].createElement(_.PageLayout, 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: "/cities/portland"
  }, "View the Portland Collection")));
};

CardDetailPage.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
};
CardDetailPage.displayName = "CardDetailPage";
var _default = CardDetailPage;
exports["default"] = _default;