UNPKG

ze-react-component-library

Version:
52 lines (50 loc) 1.49 kB
import "antd/es/tag/style"; import _Tag from "antd/es/tag"; import "antd/es/space/style"; import _Space from "antd/es/space"; import "antd/es/typography/style"; import _Typography from "antd/es/typography"; import React from "react"; import { useRequest } from "@umijs/hooks"; import { requestHot } from "../request"; import "./index.less"; import useLocale from "../hooks/useLocale"; var Title = _Typography.Title; var ZEHots = function ZEHots(_a) { var _onClick = _a.onClick; var t = useLocale().t; var hots = useRequest(function () { return requestHot(); }, { initialData: [], formatResult: function formatResult(res) { return ((res === null || res === void 0 ? void 0 : res.hot) || "").split("\n").map(function (h) { return h.trim(); }).filter(function (h) { return h.length > 0; }); } }).data; return /*#__PURE__*/React.createElement("div", { className: "ze-hots" }, /*#__PURE__*/React.createElement(Title, { level: 5, style: { marginBottom: 16 } }, t("nlq.hot"), "\uFF1A"), /*#__PURE__*/React.createElement(_Space, { style: { gap: 12 }, wrap: true }, hots === null || hots === void 0 ? void 0 : hots.map(function (i) { return /*#__PURE__*/React.createElement(_Tag, { className: "ze-tag", key: i, onClick: function onClick() { _onClick === null || _onClick === void 0 ? void 0 : _onClick(i); } }, i); }))); }; export default ZEHots;