@antv/dumi-theme-antv 0.6.4-beta.3 → 0.6.4-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtins/Playground/index.js +1 -1
- package/dist/common/ClientOnly.js +21 -0
- package/dist/common/CommonHelmet.js +85 -0
- package/dist/common/InViewSuspense.js +29 -0
- package/dist/hooks/useLocale.js +11 -0
- package/dist/hooks/useMenu.js +68 -73
- package/dist/layouts/DocLayout.js +32 -23
- package/dist/layouts/IndexLayout/index.js +16 -0
- package/dist/layouts/{entry/Manual.js → ManualLayout/index.js} +6 -6
- package/dist/pages/404.js +5 -4
- package/dist/pages/Example/index.js +76 -53
- package/dist/pages/Examples/components/ExampleTopicMenu/index.js +3 -2
- package/dist/pages/Examples/index.js +28 -32
- package/dist/{slots → pages/Index/components}/Cases/index.js +1 -1
- package/dist/{slots → pages/Index/components}/Detail/News.js +1 -1
- package/dist/{slots → pages/Index/components}/Detail/index.js +1 -1
- package/dist/{slots → pages/Index/components}/Features/FeatureCard.js +1 -1
- package/dist/{slots → pages/Index/components}/Features/index.js +1 -1
- package/dist/pages/Index/components/_.less +119 -0
- package/dist/{layouts/entry/Index.js → pages/Index/index.js} +18 -22
- package/dist/plugin/index.js +52 -43
- package/dist/slots/CodeEditor/index.js +4 -3
- package/dist/slots/CodePreview/CodeHeader.js +3 -2
- package/dist/slots/CodePreview/index.js +3 -2
- package/dist/slots/CodeRunner/index.js +34 -29
- package/dist/slots/ExampleSider/index.js +3 -2
- package/dist/slots/Feedback/Contributors.js +3 -2
- package/dist/slots/Feedback/EditButton.js +3 -2
- package/dist/slots/Feedback/PageFeedback.js +4 -3
- package/dist/slots/Feedback/SectionFeedback.js +3 -2
- package/dist/slots/Feedback/index.js +12 -10
- package/dist/slots/Footer/index.js +3 -2
- package/dist/slots/Header/Navs.js +66 -6
- package/dist/slots/Header/Search/index.js +1 -1
- package/dist/slots/Header/index.js +64 -105
- package/dist/slots/ManualContent/Main.js +16 -17
- package/dist/slots/ManualContent/NavigatorBanner.js +4 -2
- package/dist/slots/ManualContent/ObPreview.js +17 -0
- package/dist/slots/ManualContent/index.js +11 -4
- package/dist/slots/ManualContent/usePreview.js +6 -1
- package/dist/slots/ManualContent/utils.js +3 -13
- package/dist/slots/global.js +4 -4
- package/dist/slots/hooks.js +0 -25
- package/dist/slots/utils.js +0 -7
- package/dist/utils/env.js +10 -0
- package/dist/utils/location.js +6 -0
- package/dist/utils/user.js +13 -25
- package/package.json +5 -4
- package/dist/common/SEO.js +0 -61
- package/dist/layouts/entry/API.js +0 -12
- package/dist/pages/Example/utils.js +0 -9
- package/dist/slots/Article/index.js +0 -9
- package/dist/slots/Article/index.module.less +0 -8
- package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
- package/dist/slots/Header/Products/NavigatorBanner.js +0 -29
- package/dist/slots/Header/Products/NavigatorBanner.module.less +0 -39
- /package/dist/{slots → pages/Index/components}/Cases/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Companies/index.js +0 -0
- /package/dist/{slots → pages/Index/components}/Companies/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Detail/News.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Detail/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Features/FeatureCard.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Features/index.module.less +0 -0
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* 组件的 header
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
var CodeHeader = function CodeHeader(_ref) {
|
|
7
7
|
var title = _ref.title,
|
|
8
8
|
relativePath = _ref.relativePath,
|
|
9
9
|
githubUrl = _ref.githubUrl;
|
|
@@ -30,4 +30,5 @@ export var CodeHeader = function CodeHeader(_ref) {
|
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
|
-
};
|
|
33
|
+
};
|
|
34
|
+
export default CodeHeader;
|
|
@@ -11,7 +11,7 @@ function getErrorMessage(e) {
|
|
|
11
11
|
* 1. 一些 header 菜单
|
|
12
12
|
* 2. 错误预览
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
var CodePreview = function CodePreview(_ref) {
|
|
15
15
|
var isPlayground = _ref.isPlayground,
|
|
16
16
|
exampleId = _ref.exampleId,
|
|
17
17
|
header = _ref.header,
|
|
@@ -33,4 +33,5 @@ export var CodePreview = function CodePreview(_ref) {
|
|
|
33
33
|
}),
|
|
34
34
|
subTitle: /*#__PURE__*/React.createElement("pre", null, getErrorMessage(error))
|
|
35
35
|
}) : null));
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
export default CodePreview;
|
|
@@ -8,16 +8,22 @@ import { useLocale, useSiteData } from 'dumi';
|
|
|
8
8
|
import { noop } from 'lodash-es';
|
|
9
9
|
import React, { useState } from 'react';
|
|
10
10
|
import SplitPane from 'react-split-pane';
|
|
11
|
+
import ClientOnly from "../../common/ClientOnly";
|
|
12
|
+
import InViewSuspense from "../../common/InViewSuspense";
|
|
11
13
|
import { NotFound } from "dumi/theme/slots/404";
|
|
12
|
-
import
|
|
13
|
-
import { CodePreview } from "dumi/theme/slots/CodePreview";
|
|
14
|
-
import { CodeHeader } from "../CodePreview/CodeHeader";
|
|
14
|
+
import CodeHeader from "../CodePreview/CodeHeader";
|
|
15
15
|
import { ic } from "../hooks";
|
|
16
16
|
import { getDemoInfo } from "./utils";
|
|
17
|
+
var CodeEditor = /*#__PURE__*/React.lazy(function () {
|
|
18
|
+
return import("dumi/theme/slots/CodeEditor");
|
|
19
|
+
});
|
|
20
|
+
var CodePreview = /*#__PURE__*/React.lazy(function () {
|
|
21
|
+
return import("dumi/theme/slots/CodePreview");
|
|
22
|
+
});
|
|
17
23
|
/**
|
|
18
24
|
* 代码编辑器 + 代码预览区域
|
|
19
25
|
*/
|
|
20
|
-
|
|
26
|
+
var CodeRunner = function CodeRunner(_ref) {
|
|
21
27
|
var exampleTopics = _ref.exampleTopics,
|
|
22
28
|
topic = _ref.topic,
|
|
23
29
|
example = _ref.example,
|
|
@@ -53,28 +59,27 @@ export var CodeRunner = function CodeRunner(_ref) {
|
|
|
53
59
|
githubUrl: githubUrl
|
|
54
60
|
});
|
|
55
61
|
var exampleId = "".concat(topic, "_").concat(example, "_").concat(demo);
|
|
56
|
-
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
62
|
+
return /*#__PURE__*/React.createElement(InViewSuspense, {
|
|
63
|
+
fallback: null
|
|
64
|
+
}, /*#__PURE__*/React.createElement(SplitPane, {
|
|
65
|
+
split: "vertical",
|
|
66
|
+
defaultSize: "".concat((1 - size) * 100, "%"),
|
|
67
|
+
minSize: 100
|
|
68
|
+
}, /*#__PURE__*/React.createElement(CodePreview, {
|
|
69
|
+
exampleId: exampleId,
|
|
70
|
+
error: error,
|
|
71
|
+
header: header,
|
|
72
|
+
isPlayground: isPlayground
|
|
73
|
+
}), /*#__PURE__*/React.createElement(ClientOnly, null, /*#__PURE__*/React.createElement(CodeEditor, {
|
|
74
|
+
exampleId: exampleId,
|
|
75
|
+
source: source,
|
|
76
|
+
relativePath: relativePath,
|
|
77
|
+
replaceId: replaceId,
|
|
78
|
+
onError: setError,
|
|
79
|
+
onFullscreen: setFullscreen,
|
|
80
|
+
onDestroy: noop,
|
|
81
|
+
onReady: noop,
|
|
82
|
+
playground: playground
|
|
83
|
+
}))));
|
|
84
|
+
};
|
|
85
|
+
export default CodeRunner;
|
|
@@ -26,7 +26,7 @@ var MenuIcon = createFromIconfontCN({
|
|
|
26
26
|
/**
|
|
27
27
|
* DEMO 预览页面的菜单
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
var ExampleSider = function ExampleSider(props) {
|
|
30
30
|
var currentDemo = props.currentDemo,
|
|
31
31
|
onDemoClicked = props.onDemoClicked,
|
|
32
32
|
exampleTopics = props.exampleTopics;
|
|
@@ -187,4 +187,5 @@ export var ExampleSider = function ExampleSider(props) {
|
|
|
187
187
|
setOpenKeys(keys);
|
|
188
188
|
}
|
|
189
189
|
}, renderSubMenu()));
|
|
190
|
-
};
|
|
190
|
+
};
|
|
191
|
+
export default ExampleSider;
|
|
@@ -9,7 +9,7 @@ var StyledContributorsWrapper = styled.div.withConfig({
|
|
|
9
9
|
displayName: "StyledContributorsWrapper",
|
|
10
10
|
componentId: "dumi-theme-antv-c7ef__sc-11d631u-0"
|
|
11
11
|
})(["margin-top:80px;.title{margin-bottom:14px;color:#bfbfbf;}.list{display:flex;flex-wrap:wrap;clear:both;li{height:24px;transition:all 0.3s;margin-inline-end:-8px;}&:hover{li{margin-inline-end:0;}}}"]);
|
|
12
|
-
|
|
12
|
+
var Contributors = function Contributors() {
|
|
13
13
|
var _useIntl = useIntl(),
|
|
14
14
|
formatMessage = _useIntl.formatMessage;
|
|
15
15
|
var _useSiteData$themeCon = useSiteData().themeConfig.sitePackagePath,
|
|
@@ -42,4 +42,5 @@ export var Contributors = function Contributors() {
|
|
|
42
42
|
},
|
|
43
43
|
branch: defaultBranch
|
|
44
44
|
}));
|
|
45
|
-
};
|
|
45
|
+
};
|
|
46
|
+
export default Contributors;
|
|
@@ -2,7 +2,7 @@ import { FormOutlined } from '@ant-design/icons';
|
|
|
2
2
|
import { useIntl, useRouteMeta, useSiteData } from 'dumi';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useGithubRepo } from "../../utils/github";
|
|
5
|
-
|
|
5
|
+
var EditButton = function EditButton() {
|
|
6
6
|
var meta = useRouteMeta();
|
|
7
7
|
var _useIntl = useIntl(),
|
|
8
8
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -33,4 +33,5 @@ export var EditButton = function EditButton() {
|
|
|
33
33
|
}, formatMessage({
|
|
34
34
|
id: '在 GitHub 上编辑此页'
|
|
35
35
|
})));
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
export default EditButton;
|
|
@@ -5,7 +5,8 @@ import { PageFeedbackVoteButtons } from "./PageFeedbackVoteButtons";
|
|
|
5
5
|
var StyledWrapper = styled.div.withConfig({
|
|
6
6
|
displayName: "StyledWrapper",
|
|
7
7
|
componentId: "dumi-theme-antv-c7ef__sc-1vamzhw-0"
|
|
8
|
-
})(["margin:2px 4px 8px 4px;box-shadow:0 2px 6px 0 rgba(0,0,0
|
|
9
|
-
|
|
8
|
+
})(["margin:2px 4px 8px 4px;box-shadow:0 2px 6px 0 rgba(0,0,0,0.08);border-radius:8px;padding:10px 12px;width:fit-content;background-color:#fff;font-size:14px;"]);
|
|
9
|
+
var PageFeedback = function PageFeedback() {
|
|
10
10
|
return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(PageFeedbackVoteButtons, null), /*#__PURE__*/React.createElement(PageFeedbackReasonForm, null));
|
|
11
|
-
};
|
|
11
|
+
};
|
|
12
|
+
export default PageFeedback;
|
|
@@ -14,7 +14,7 @@ var StyledWrapper = styled.div.withConfig({
|
|
|
14
14
|
displayName: "StyledWrapper",
|
|
15
15
|
componentId: "dumi-theme-antv-c7ef__sc-vcamqv-0"
|
|
16
16
|
})(["background-color:#fff;border-radius:12px;box-shadow:0 0.5rem 1.2rem #f0f1f2;transition:height 0.3s ease-in-out;width:262px;position:fixed;z-index:1001;padding:10px 18px;border-radius:8px;transition:top 0.3s ease-in-out,right 0.3s ease-in-out;"]);
|
|
17
|
-
|
|
17
|
+
var SectionFeedback = function SectionFeedback() {
|
|
18
18
|
var feedbackState = useSnapshot(feedbackStore);
|
|
19
19
|
var location = useLocation();
|
|
20
20
|
useEffect(function () {
|
|
@@ -94,4 +94,5 @@ var findClosetElement = function findClosetElement(e, elements) {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
return closestElement;
|
|
97
|
-
};
|
|
97
|
+
};
|
|
98
|
+
export default SectionFeedback;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { useSiteData } from 'dumi';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import React, { lazy } from 'react';
|
|
3
|
+
import InViewSuspense from "../../common/InViewSuspense";
|
|
4
|
+
var EditButton = /*#__PURE__*/lazy(function () {
|
|
5
|
+
return import("./EditButton");
|
|
6
|
+
});
|
|
7
|
+
var Contributors = /*#__PURE__*/lazy(function () {
|
|
8
|
+
return import("./Contributors");
|
|
9
|
+
});
|
|
10
|
+
var SectionFeedback = /*#__PURE__*/lazy(function () {
|
|
11
|
+
return import("./SectionFeedback");
|
|
12
|
+
});
|
|
11
13
|
export var Feedback = function Feedback() {
|
|
12
14
|
var _useSiteData = useSiteData(),
|
|
13
15
|
themeConfig = _useSiteData.themeConfig;
|
|
@@ -15,5 +17,5 @@ export var Feedback = function Feedback() {
|
|
|
15
17
|
if (!feedback) {
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
|
-
return /*#__PURE__*/React.createElement(
|
|
20
|
+
return /*#__PURE__*/React.createElement(InViewSuspense, null, /*#__PURE__*/React.createElement(EditButton, null), /*#__PURE__*/React.createElement(Contributors, null), /*#__PURE__*/React.createElement(SectionFeedback, null));
|
|
19
21
|
};
|
|
@@ -18,7 +18,7 @@ import styles from "./index.module.less";
|
|
|
18
18
|
* 底部菜单
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
var Footer = function Footer(props) {
|
|
22
22
|
var columns = props.columns,
|
|
23
23
|
bottom = props.bottom,
|
|
24
24
|
language = props.language,
|
|
@@ -222,4 +222,5 @@ export var Footer = function Footer(props) {
|
|
|
222
222
|
href: "https://xtech.antfin.com/"
|
|
223
223
|
}, "AntV")))))
|
|
224
224
|
}, omit(restProps, ['githubUrl'])));
|
|
225
|
-
};
|
|
225
|
+
};
|
|
226
|
+
export default Footer;
|
|
@@ -2,14 +2,70 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
4
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
8
|
import { DownOutlined, LinkOutlined } from '@ant-design/icons';
|
|
6
9
|
import { Dropdown, Menu } from 'antd';
|
|
7
10
|
import cx from 'classnames';
|
|
8
11
|
import { Link, useLocale } from 'dumi';
|
|
9
12
|
import { size } from 'lodash-es';
|
|
10
13
|
import React from 'react';
|
|
14
|
+
import { useMenuData } from "../../hooks/useMenu";
|
|
11
15
|
import styles from "./index.module.less";
|
|
12
16
|
import { getNavCategory } from "./utils";
|
|
17
|
+
function getNavMeta(pathname, navs) {
|
|
18
|
+
return navs.find(function (nav) {
|
|
19
|
+
var _nav$slug;
|
|
20
|
+
return (nav === null || nav === void 0 || (_nav$slug = nav.slug) === null || _nav$slug === void 0 ? void 0 : _nav$slug.replace('docs/', '/')) === pathname;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function isExactNavLink(pathname, navs) {
|
|
24
|
+
var meta = getNavMeta(pathname, navs);
|
|
25
|
+
return !!meta && meta.exact;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 查找与路径匹配的第一个菜单项
|
|
30
|
+
*/
|
|
31
|
+
function findMatchingMenuItem(pathname, menuData) {
|
|
32
|
+
if (!menuData || !Array.isArray(menuData) || menuData.length === 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
var _iterator = _createForOfIteratorHelper(menuData),
|
|
36
|
+
_step;
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var menuItem = _step.value;
|
|
40
|
+
if (menuItem.link) {
|
|
41
|
+
var normalizedLink = menuItem.link.startsWith('/') ? menuItem.link : "/".concat(menuItem.link);
|
|
42
|
+
if (normalizedLink === pathname || normalizedLink.startsWith(pathname)) {
|
|
43
|
+
return menuItem;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (menuItem.children && menuItem.children.length > 0) {
|
|
47
|
+
var matchedChild = findMatchingMenuItem(pathname, menuItem.children);
|
|
48
|
+
if (matchedChild) return matchedChild;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch (err) {
|
|
52
|
+
_iterator.e(err);
|
|
53
|
+
} finally {
|
|
54
|
+
_iterator.f();
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
function getNavLink(pathname, navs, menuData) {
|
|
59
|
+
if (isExactNavLink(pathname, navs)) {
|
|
60
|
+
return pathname;
|
|
61
|
+
}
|
|
62
|
+
var matchingMenuItem = findMatchingMenuItem(pathname, menuData);
|
|
63
|
+
if (matchingMenuItem) {
|
|
64
|
+
return matchingMenuItem.link;
|
|
65
|
+
}
|
|
66
|
+
return pathname;
|
|
67
|
+
}
|
|
68
|
+
|
|
13
69
|
/**
|
|
14
70
|
* Header 中的导航菜单
|
|
15
71
|
*/
|
|
@@ -17,17 +73,21 @@ export var Navs = function Navs(_ref) {
|
|
|
17
73
|
var navs = _ref.navs,
|
|
18
74
|
path = _ref.path;
|
|
19
75
|
var locale = useLocale();
|
|
76
|
+
var getMenuData = useMenuData();
|
|
20
77
|
return /*#__PURE__*/React.createElement(React.Fragment, null, navs.map(function (nav) {
|
|
21
78
|
var title = nav.title[locale.id];
|
|
22
79
|
var href = '';
|
|
23
80
|
var className = '';
|
|
24
81
|
if (nav.slug) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
82
|
+
if (nav.slug.startsWith('http')) {
|
|
83
|
+
href = nav.slug;
|
|
84
|
+
} else {
|
|
85
|
+
// 去除 docs 防止新页面 404 和 本页重新刷新。
|
|
86
|
+
href = "/".concat(nav.slug).replace(/^\/docs(?=\/)/, '');
|
|
87
|
+
if (locale.id === 'en') {
|
|
88
|
+
href = "/en".concat(href);
|
|
89
|
+
}
|
|
90
|
+
href = getNavLink(href, navs, getMenuData(href));
|
|
31
91
|
}
|
|
32
92
|
className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, getNavCategory(path) === getNavCategory(href)));
|
|
33
93
|
}
|
|
@@ -8,9 +8,9 @@ import { SearchOutlined } from '@ant-design/icons';
|
|
|
8
8
|
import { Popover } from 'antd';
|
|
9
9
|
import { useIntl, useSiteData, useSiteSearch } from 'dumi';
|
|
10
10
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
11
|
-
import { SearchResult } from "./SearchResult";
|
|
12
11
|
import { getSearchResults } from "./helper";
|
|
13
12
|
import styles from "./index.module.less";
|
|
13
|
+
import { SearchResult } from "./SearchResult";
|
|
14
14
|
export var Search = function Search() {
|
|
15
15
|
var intl = useIntl();
|
|
16
16
|
var _useState = useState(false),
|