import React from "react";
import PropTypes from "prop-types";
import { Link } from "react-router";
import { PageLayout } from "../..";

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.createElement(PageLayout, null, React.createElement(CardComponent, null));
  }

  return React.createElement(PageLayout, null, React.createElement("h1", null, "Card not found"), React.createElement("p", null, "The card you are looking for doesn't exist.", React.createElement(Link, {
    to: "/cities/portland"
  }, "View the Portland Collection")));
};

CardDetailPage.propTypes = {
  params: PropTypes.shape({
    slug: PropTypes.string.isRequired
  }),
  CardRegistry: PropTypes.shape({
    entries: PropTypes.arrayOf(PropTypes.shape({
      component: PropTypes.func.isRequired,
      project: PropTypes.string.isRequired,
      slug: PropTypes.string.isRequired
    }))
  }).isRequired
};
CardDetailPage.displayName = "CardDetailPage";
export default CardDetailPage;