import React from "react";
import PropTypes from "prop-types";
import Feature from "ol/Feature";
import Link from "../../components/Link";
import "./ConstructionPopup.scss";
import useTranslation from "../../utils/useTranslation";
const propTypes = {
  feature: PropTypes.instanceOf(Feature).isRequired
};
const capitalize = stg => "".concat(stg.charAt(0).toUpperCase()).concat(stg.slice(1));
function ConstructionPopup(_ref) {
  let {
    feature
  } = _ref;
  const {
    t
  } = useTranslation();
  let projektort;
  let ort;
  let artAndOrt;
  let link1;
  let link2;
  let link3;
  if (feature.get("projektort")) {
    projektort = /*#__PURE__*/React.createElement("div", {
      className: "wkp-construction-popup-subtitle"
    }, t(feature.get("projektort")));
  }
  if (feature.get("ort")) {
    ort = /*#__PURE__*/React.createElement("span", null, "(", t(capitalize(feature.get("ort"))), ")");
  }
  if (feature.get("art")) {
    artAndOrt = /*#__PURE__*/React.createElement("div", {
      className: "wkp-construction-popup-desc"
    }, /*#__PURE__*/React.createElement("span", null, t(capitalize(feature.get("art")))), " ", ort);
  }
  if (feature.get("link1_title") && feature.get("link1_url")) {
    link1 = /*#__PURE__*/React.createElement("div", {
      className: "wkp-construction-popup-link"
    }, /*#__PURE__*/React.createElement(Link, {
      href: feature.get("link1_url")
    }, t(feature.get("link1_title"))));
  }
  if (feature.get("link2_title") && feature.get("link2_url")) {
    link2 = /*#__PURE__*/React.createElement("div", {
      className: "wkp-construction-popup-link"
    }, /*#__PURE__*/React.createElement(Link, {
      href: feature.get("link2_url")
    }, t(feature.get("link2_title"))));
  }
  if (feature.get("link3_title") && feature.get("link3_url")) {
    link3 = /*#__PURE__*/React.createElement("div", {
      className: "wkp-construction-popup-link"
    }, /*#__PURE__*/React.createElement(Link, {
      href: feature.get("link3_url")
    }, t(feature.get("link3_title"))));
  }
  return /*#__PURE__*/React.createElement("div", {
    className: "wkp-construction-popup"
  }, projektort, artAndOrt, link1, link2, link3);
}
ConstructionPopup.propTypes = propTypes;
const composed = ConstructionPopup;
composed.renderTitle = feat => feat.get("projektname");
export default composed;
//# sourceMappingURL=ConstructionPopup.js.map