import React from 'react';

// 内库使用-start
import LocaleUtil from "./../../../../utils/LocaleUtil";
import Result from "./../../../Result";
// 内库使用-end

/* 测试使用-start
import { Result, LocaleUtil } from 'seedsui-react'
测试使用-end */

// 附近结果
function Main(_ref) {
  var list = _ref.list,
    onChange = _ref.onChange;
  // 错误信息
  var status = '500';
  var errMsg = typeof list === 'string' ? list : null;
  if (Array.isArray(list) && list.length === 0) {
    status = 'empty';
    errMsg = LocaleUtil.locale('暂无数据', 'SeedsUI_no_data');
  }
  return /*#__PURE__*/React.createElement("div", {
    className: "map-nearbyControl-main"
  }, errMsg && /*#__PURE__*/React.createElement(Result, {
    className: "map-main-result",
    status: status,
    title: errMsg
  }), Array.isArray(list) && list.length && list.map(function (item, index) {
    return /*#__PURE__*/React.createElement("div", {
      className: "map-nearbyControl-item",
      key: index,
      "data-nearby-item-id": "".concat(item.longitude, ",").concat(item.latitude),
      onClick: function onClick(e) {
        onChange && onChange(item);
      }
    }, /*#__PURE__*/React.createElement("div", {
      className: "map-nearbyControl-item-content"
    }, /*#__PURE__*/React.createElement("p", {
      className: "map-nearbyControl-item-content-title"
    }, item.name), /*#__PURE__*/React.createElement("p", {
      className: "map-nearbyControl-item-content-description"
    }, item.address || '')));
  }));
}
export default Main;