"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");

var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");

require("core-js/modules/es.function.name");

_Object$defineProperty(exports, "__esModule", {
  value: true
});

exports.default = void 0;

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

var _styles = require("@material-ui/core/styles");

var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));

var _FeatureHeader = _interopRequireDefault(require("../internal/FeatureHeader"));

var _Image = _interopRequireDefault(require("../internal/Image"));

var _DetailsTable = _interopRequireDefault(require("./DetailsTable"));

var _dom = require("../utils/dom");

// @flow
var useStyles = (0, _styles.makeStyles)({
  imageWrapper: {
    width: '100%',
    height: '12cm',
    borderTop: '1px solid rgb(224, 224, 224)'
  },
  notes: {
    borderBottom: '1px solid rgb(224, 224, 224)',
    paddingBottom: 16
  }
});
/*:: type Props = {|
  name?: string,
  iconLabel?: string,
  iconColor?: string,
  coords?: Coordinates,
  createdAt?: Date,
  imageSrc?: string,
  fields: Array<Field>,
  tags?: JSONObject,
  paperSize: PaperSize
|}*/

var ReportPageContent = function ReportPageContent(_ref) {
  var name = _ref.name,
      iconLabel = _ref.iconLabel,
      iconColor = _ref.iconColor,
      coords = _ref.coords,
      createdAt = _ref.createdAt,
      imageSrc = _ref.imageSrc,
      fields = _ref.fields,
      tags = _ref.tags,
      paperSize = _ref.paperSize;
  var cx = useStyles();
  var notes = tags && (tags.note || tags.notes);
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_FeatureHeader.default, {
    name: name,
    iconLabel: iconLabel,
    iconColor: iconColor,
    coords: coords,
    createdAt: createdAt
  }), imageSrc && /*#__PURE__*/_react.default.createElement("div", {
    className: cx.imageWrapper
  }, /*#__PURE__*/_react.default.createElement(_Image.default, {
    style: {
      width: '100%',
      height: '12cm'
    },
    src: imageSrc
  })), notes && /*#__PURE__*/_react.default.createElement(_Typography.default, {
    className: cx.notes
  }, notes), tags && /*#__PURE__*/_react.default.createElement(_DetailsTable.default, {
    fields: fields,
    tags: tags,
    width: paperSize === 'a4' ? 21 * (0, _dom.cm)() - (0, _dom.inch)() : 7.5 * (0, _dom.inch)()
  }));
};

var _default = ReportPageContent;
exports.default = _default;
//# sourceMappingURL=ReportPageContent.js.map