import React from 'react';
import { backIcon, shareIcon } from '../../../../assets/IconBase64';
import { browserVersion, sendToAndroid, sendToIos } from '../../../../utils/androidUtil';
import { navigateTo } from '../../../../utils/commonUtil';
import './index.less';
export default function pageTitle(props) {
  var _props$data = props.data,
      data = _props$data === void 0 ? {} : _props$data;

  var onShare = function onShare() {
    if (browserVersion().isApp && browserVersion().ios) {
      sendToIos({
        type: 'SHARE'
      });
      return;
    }

    window.MParams && window.MParams.api && window.MParams.api.showShareModal();
  };

  var onBack = function onBack() {
    if (browserVersion().isApp && browserVersion().android) {
      sendToAndroid({
        type: 'onBack',
        params: {}
      });
      return;
    }

    if (browserVersion().isApp && browserVersion().ios) {
      sendToIos({
        type: 'BACK'
      });
      return;
    }

    navigateTo('/main/home');
  };

  return /*#__PURE__*/React.createElement("div", {
    className: "header"
  }, /*#__PURE__*/React.createElement("div", {
    onClick: onBack
  }, /*#__PURE__*/React.createElement("img", {
    className: "back",
    alt: "back",
    src: backIcon
  })), /*#__PURE__*/React.createElement("div", {
    className: "title"
  }, data.icon && /*#__PURE__*/React.createElement("img", {
    alt: "",
    src: data.icon
  }), /*#__PURE__*/React.createElement("span", null, data.pageName)), /*#__PURE__*/React.createElement("img", {
    className: "share",
    alt: "share",
    src: shareIcon,
    onClick: onShare
  }));
}