@antv/dumi-theme-antv 0.6.4-alpha.1 → 0.6.4-alpha.3
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.
|
@@ -4,8 +4,8 @@ import { every, find, get } from 'lodash-es';
|
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
6
6
|
import { useSnapshot } from 'valtio';
|
|
7
|
-
import InViewSuspense from "../../common/InViewSuspense";
|
|
8
7
|
import CommonHelmet from "../../common/CommonHelmet";
|
|
8
|
+
import InViewSuspense from "../../common/InViewSuspense";
|
|
9
9
|
import { ThemeAntVContext } from "../../context";
|
|
10
10
|
import { store } from "../../model";
|
|
11
11
|
import { API } from "dumi/theme/slots/API";
|
|
@@ -25,6 +25,7 @@ var ExampleSider = /*#__PURE__*/React.lazy(function () {
|
|
|
25
25
|
* 解析 Example 页面的元数据
|
|
26
26
|
*/
|
|
27
27
|
var useExampleMeta = function useExampleMeta() {
|
|
28
|
+
var _exampleTopics$find;
|
|
28
29
|
/** 示例页面的元数据信息 */
|
|
29
30
|
var metaData = useContext(ThemeAntVContext);
|
|
30
31
|
var exampleTopics = metaData.meta.exampleTopics;
|
|
@@ -33,9 +34,12 @@ var useExampleMeta = function useExampleMeta() {
|
|
|
33
34
|
example = _useParams.example;
|
|
34
35
|
var _useLocation = useLocation(),
|
|
35
36
|
hash = _useLocation.hash;
|
|
36
|
-
var examples =
|
|
37
|
-
var exampleDemo = find(examples, function (_ref) {
|
|
37
|
+
var examples = (_exampleTopics$find = exampleTopics.find(function (_ref) {
|
|
38
38
|
var id = _ref.id;
|
|
39
|
+
return id === topic;
|
|
40
|
+
})) === null || _exampleTopics$find === void 0 ? void 0 : _exampleTopics$find.examples;
|
|
41
|
+
var exampleDemo = find(examples, function (_ref2) {
|
|
42
|
+
var id = _ref2.id;
|
|
39
43
|
return id === example;
|
|
40
44
|
});
|
|
41
45
|
// examples/case/id hash 为空,可以默认第一个 example 对应的 demo
|
|
@@ -86,7 +90,7 @@ var Example = function Example() {
|
|
|
86
90
|
return /*#__PURE__*/React.createElement("div", {
|
|
87
91
|
className: styles.example
|
|
88
92
|
}, /*#__PURE__*/React.createElement(CommonHelmet, {
|
|
89
|
-
title: exampleTitle,
|
|
93
|
+
title: "".concat(demoTitle, "\xB7").concat(exampleTitle),
|
|
90
94
|
description: demoTitle
|
|
91
95
|
}), /*#__PURE__*/React.createElement(InViewSuspense, null, /*#__PURE__*/React.createElement(Header, {
|
|
92
96
|
isHomePage: false
|