UNPKG

2.28 kBJavaScriptView Raw
1import React from 'react';
2import { defaultRenderLogo } from "./index";
3import { jsx as _jsx } from "react/jsx-runtime";
4import { jsxs as _jsxs } from "react/jsx-runtime";
5export var DefaultContent = function DefaultContent(props) {
6 var appList = props.appList,
7 baseClassName = props.baseClassName,
8 hashId = props.hashId,
9 itemClick = props.itemClick;
10 return /*#__PURE__*/_jsx("div", {
11 className: "".concat(baseClassName, "-content ").concat(hashId),
12 children: /*#__PURE__*/_jsx("ul", {
13 className: "".concat(baseClassName, "-content-list ").concat(hashId),
14 children: appList === null || appList === void 0 ? void 0 : appList.map(function (app, index) {
15 var _app$children;
16 if (app !== null && app !== void 0 && (_app$children = app.children) !== null && _app$children !== void 0 && _app$children.length) {
17 return /*#__PURE__*/_jsxs("div", {
18 className: "".concat(baseClassName, "-content-list-item-group ").concat(hashId).trim(),
19 children: [/*#__PURE__*/_jsx("div", {
20 className: "".concat(baseClassName, "-content-list-item-group-title ").concat(hashId).trim(),
21 children: app.title
22 }), /*#__PURE__*/_jsx(DefaultContent, {
23 hashId: hashId,
24 itemClick: itemClick,
25 appList: app === null || app === void 0 ? void 0 : app.children,
26 baseClassName: baseClassName
27 })]
28 }, index);
29 }
30 return /*#__PURE__*/_jsx("li", {
31 className: "".concat(baseClassName, "-content-list-item ").concat(hashId).trim(),
32 children: /*#__PURE__*/_jsxs("a", {
33 href: itemClick ? undefined : app.url,
34 onClick: function onClick() {
35 return itemClick === null || itemClick === void 0 ? void 0 : itemClick(app);
36 },
37 target: app.target,
38 rel: "noreferrer",
39 children: [defaultRenderLogo(app.icon), /*#__PURE__*/_jsxs("div", {
40 children: [/*#__PURE__*/_jsx("div", {
41 children: app.title
42 }), app.desc ? /*#__PURE__*/_jsx("span", {
43 children: app.desc
44 }) : null]
45 })]
46 })
47 }, index);
48 })
49 })
50 });
51};
\No newline at end of file