"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SearchResultPreview;

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

var Components = _interopRequireWildcard(require("@patternplate/components"));

var _lodash = require("lodash");

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

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

function SearchResultPreview(props) {
  const item = props.activeItem;

  switch (item.contentType) {
    case "doc":
      return _react.default.createElement(Components.Search.SearchResultPreview, props, _react.default.createElement(Components.Markdown, {
        source: item.contents
      }));

    default:
      return _react.default.createElement(Components.Search.SearchResultPreview, props, _react.default.createElement(Components.InfoPane, {
        active: true,
        demoDependencies: (0, _lodash.values)(item.demoDependencies),
        demoDependents: (0, _lodash.values)(item.demoDependents),
        dependencies: (0, _lodash.values)(item.dependencies),
        dependents: (0, _lodash.values)(item.dependents),
        flag: item.manifest.flag,
        id: item.id,
        manifest: JSON.stringify(item.manifest, null, "  "),
        name: item.manifest.displayName,
        tags: item.manifest.tags,
        version: item.manifest.version
      }));
  }
}
//# sourceMappingURL=search-preview.js.map