@antv/dumi-theme-antv 0.3.0-beta.12 → 0.3.0-beta.14

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.
@@ -0,0 +1,449 @@
1
+ @import '../_.less';
2
+
3
+ .wrapper {
4
+ min-height: 650px;
5
+ max-height: 803px;
6
+ background: linear-gradient(225deg, #ffffff, #f0f5ff);
7
+ height: calc(94vh);
8
+ position: relative;
9
+ overflow: hidden;
10
+
11
+ .content {
12
+ .container1440;
13
+ height: 100%;
14
+ position: relative;
15
+ }
16
+
17
+ .text {
18
+ position: relative;
19
+ top: 26%;
20
+ z-index: 1;
21
+ margin-left: 4.5%;
22
+
23
+ .title {
24
+ font-size: 3.4em; //2.875em;
25
+ font-weight: 800;
26
+ color: rgba(0, 0, 0, 1);
27
+ position: relative;
28
+ }
29
+
30
+ .description {
31
+ margin-top: 0.83%; //12px;
32
+ margin-bottom: 0px;
33
+ color: rgba(106, 123, 140, 1);
34
+ font-size: 1.14em;
35
+ font-weight: 200;
36
+ position: relative;
37
+ width: 40%;
38
+ max-width: 700px;
39
+ }
40
+
41
+ .buttons {
42
+ display: flex;
43
+ margin-top: 5.56%;
44
+
45
+ .buttonLink+.buttonLink {
46
+ margin-left: 16px;
47
+ }
48
+
49
+ .buttonLink {
50
+ cursor: pointer;
51
+ border-radius: 50px;
52
+ min-width: 134px;
53
+ padding-left: 15px;
54
+ padding-right: 15px;
55
+ height: 40px;
56
+ z-index: 10;
57
+ position: relative;
58
+ transition: all 0.3s;
59
+ border: 1px solid @primary-color;
60
+ color: @primary-color;
61
+ background: transparent;
62
+ text-align: center;
63
+ font-size: 1.14em;
64
+ line-height: 40px;
65
+
66
+ &:hover {
67
+ color: tint(@primary-color, 25%);
68
+ border: 1px solid tint(@primary-color, 25%);
69
+ background-color: fade(@primary-color, 3%);
70
+ }
71
+
72
+ &.primary {
73
+ border: none;
74
+ outline: none;
75
+ color: #fff;
76
+ background: linear-gradient(60deg,
77
+ fade(@primary-color, 70%),
78
+ shade(@primary-color, 20%));
79
+ opacity: 0.8;
80
+ box-shadow: 0 8px 10px fade(@primary-color, 20%);
81
+
82
+ &:hover {
83
+ opacity: 1;
84
+ }
85
+ }
86
+ }
87
+
88
+ .videoButtonWrapper {
89
+ margin-left: 16px;
90
+ width: fit-content;
91
+ height: fit-content;
92
+
93
+ .videoButton {
94
+ width: 40px;
95
+ height: 40px;
96
+ background-size: contain;
97
+ border: 1px solid @primary-color;
98
+ border-radius: 20px;
99
+ transition: all 0.15s;
100
+ display: flex;
101
+ cursor: pointer;
102
+ overflow: hidden;
103
+
104
+ .videoButtonIcon {
105
+ margin-left: 12px;
106
+ font-size: 16px;
107
+ color: @primary-color;
108
+ line-height: 44px;
109
+ }
110
+
111
+ .videoButtonText {
112
+ line-height: 40px;
113
+ margin-left: 10px;
114
+ color: @primary-color;
115
+ }
116
+
117
+ &:hover {
118
+ width: 134px;
119
+ }
120
+ }
121
+ }
122
+
123
+ .githubWrapper {
124
+ margin-left: 16px;
125
+ display: flex;
126
+
127
+ :global {
128
+ .gh-btn {
129
+ width: 40px;
130
+ height: 40px;
131
+ border-radius: 20px;
132
+ padding: 9px;
133
+ border: 1px solid #ced4d9;
134
+ background: transparent;
135
+ text-decoration: none;
136
+ white-space: nowrap;
137
+ display: flex;
138
+ cursor: pointer;
139
+ float: left;
140
+ transition: all 0.15s;
141
+
142
+ &:hover {
143
+ background: #f2f4f5;
144
+ }
145
+
146
+ .gh-ico {
147
+ width: 16px;
148
+ height: 16px;
149
+ margin-left: 2px;
150
+ margin-top: 2px;
151
+ background-image: url(https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*Nk9mQ48ZoZMAAAAAAAAAAABkARQnAQ);
152
+ background-size: 100% 100%;
153
+ background-repeat: no-repeat;
154
+ box-sizing: border-box;
155
+ cursor: pointer;
156
+ color: #333;
157
+ }
158
+
159
+ .gh-text {
160
+ display: none;
161
+ }
162
+ }
163
+
164
+ .gh-count {
165
+ position: relative;
166
+ display: none;
167
+ /* hidden to start */
168
+ margin-left: 52px;
169
+ margin-top: 7px;
170
+ border: 1px solid #d4d4d4;
171
+ padding: 2px 10px;
172
+ font-weight: 700;
173
+ height: 65%;
174
+ border-radius: 5px;
175
+ color: rgb(49, 70, 89);
176
+
177
+ &:hover {
178
+ background: #f2f4f5;
179
+ transition: all 0.15s;
180
+ }
181
+ }
182
+
183
+ .gh-count:hover,
184
+ .gh-count:focus {
185
+ color: #4183c4;
186
+ }
187
+
188
+ .gh-count:before,
189
+ .gh-count:after {
190
+ content: '';
191
+ position: absolute;
192
+ display: inline-block;
193
+ width: 0;
194
+ height: 0;
195
+ border-color: transparent;
196
+ border-style: solid;
197
+ }
198
+
199
+ .gh-count:before {
200
+ top: 50%;
201
+ left: -3px;
202
+ margin-top: -5px;
203
+ border-width: 4px 4px 4px 0;
204
+ border-right-color: #fafafa;
205
+ }
206
+
207
+ .gh-count:after {
208
+ top: 50%;
209
+ border-width: 5px 5px 5px 0;
210
+ border-right-color: #d4d4d4;
211
+ left: -5px;
212
+ z-index: -1;
213
+ margin-top: -6px;
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+
220
+ .notifications {
221
+ width: 80%;
222
+ display: flex;
223
+ bottom: 40px;
224
+ position: absolute;
225
+ z-index: 3;
226
+ margin-left: 4.5%;
227
+ }
228
+
229
+ .teaser {
230
+ display: flex;
231
+ position: absolute;
232
+ right: 0;
233
+ margin-top: -300px;
234
+ width: 52%;
235
+ max-width: 598px;
236
+ height: 324px;
237
+ margin: auto;
238
+ margin-top: 0;
239
+ top: 0;
240
+ bottom: 0;
241
+
242
+ .teaserimg {
243
+ width: 100%;
244
+ height: auto;
245
+ position: relative;
246
+ }
247
+ }
248
+
249
+ .backLeftBottom {
250
+ position: absolute;
251
+ left: -8%;
252
+ bottom: -20px;
253
+ }
254
+ }
255
+
256
+ .videoModal {
257
+ :global {
258
+ .video-react-big-play-button {
259
+ display: none !important;
260
+ }
261
+
262
+ .video-react-control-bar {
263
+ border-radius: 0 0 4px 4px;
264
+ }
265
+
266
+ .video-react {
267
+ border-radius: 4px;
268
+
269
+ .video-react-video {
270
+ border-radius: 4px;
271
+ }
272
+ }
273
+
274
+ .ant-modal-close {
275
+ right: -50px;
276
+ top: -12px;
277
+ color: #fff;
278
+ }
279
+
280
+ .anticon-info-circle {
281
+ display: none !important;
282
+ }
283
+
284
+ .ant-modal-confirm-btns {
285
+ display: none !important;
286
+ }
287
+
288
+ .ant-modal-confirm-title {
289
+ display: none !important;
290
+ }
291
+
292
+ .ant-modal-close {
293
+ display: block !important;
294
+ }
295
+
296
+ .ant-modal-body {
297
+ padding: 0 !important;
298
+
299
+ .ant-modal-confirm-content {
300
+ margin: 0 !important;
301
+ }
302
+ }
303
+ }
304
+ }
305
+
306
+ @media (max-width: 1144px) {
307
+ .wrapper {
308
+ .teaser {
309
+ transition: 0.3s all;
310
+ margin: auto;
311
+ margin-top: 0;
312
+ top: 0;
313
+ bottom: 0;
314
+ }
315
+ }
316
+ }
317
+
318
+ @media (max-width: 900px) {
319
+ .wrapper {
320
+ .content {
321
+ width: 91.46%;
322
+ margin-left: 4.27%;
323
+ margin-bottom: 5%;
324
+ position: relative;
325
+ }
326
+
327
+ .text {
328
+ top: 16.7%;
329
+ text-align: center;
330
+ margin-left: 0;
331
+
332
+ .title {
333
+ font-size: 2.857em;
334
+ margin-left: 0;
335
+ }
336
+
337
+ .description {
338
+ width: 100%;
339
+ max-width: 100%;
340
+ margin-left: 0;
341
+ font-size: 1em;
342
+ }
343
+
344
+ .buttons {
345
+ display: inline-flex;
346
+
347
+ .more {
348
+ font-size: 1em;
349
+ }
350
+
351
+ .githubIframe {
352
+ height: 40px;
353
+ }
354
+
355
+ .videoButtonWrapper {
356
+ width: fit-content;
357
+ height: fit-content;
358
+ }
359
+ }
360
+ }
361
+
362
+ .notifications {
363
+ width: 100%;
364
+ display: block;
365
+ bottom: 20px;
366
+ height: 44px;
367
+ overflow: hidden;
368
+ }
369
+
370
+ .teaser {
371
+ width: 100%;
372
+ max-width: 1200px;
373
+ margin-top: auto;
374
+ margin-left: unset;
375
+ margin-right: unset;
376
+ right: unset;
377
+ top: 30%;
378
+ display: flex;
379
+ justify-content: center;
380
+
381
+ .teaserimg {
382
+ width: 40%;
383
+ margin-left: unset;
384
+ margin-right: unset;
385
+ }
386
+ }
387
+ }
388
+ }
389
+
390
+ @media (max-width: 786px) {
391
+ .wrapper {
392
+ .text {
393
+ .buttons {
394
+ .videoButtonWrapper {
395
+ display: none;
396
+ }
397
+ }
398
+ }
399
+ }
400
+ }
401
+
402
+ @media (max-width: 510px) {
403
+ .wrapper {
404
+ .text {
405
+ .buttons {
406
+ margin-top: 70%;
407
+
408
+ .githubWrapper {
409
+ display: none;
410
+ }
411
+ }
412
+ }
413
+
414
+ .teaser {
415
+ width: 100%;
416
+ top: 5%;
417
+
418
+ .teaserimg {
419
+ width: 100%;
420
+ }
421
+ }
422
+
423
+ .backLeftBottom {
424
+ display: none;
425
+ }
426
+ }
427
+ }
428
+
429
+ @media (max-width: 480px) {
430
+ .wrapper {
431
+ .text {
432
+ height: 70%;
433
+
434
+ .buttons {
435
+ bottom: 10px;
436
+ margin-top: unset;
437
+ z-index: 1;
438
+ position: absolute;
439
+ left: 0;
440
+ width: 100%;
441
+ justify-content: center;
442
+ }
443
+ }
444
+
445
+ .teaser {
446
+ top: 14%;
447
+ }
448
+ }
449
+ }
@@ -2,12 +2,12 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
 
3
3
  import React from 'react';
4
4
  import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons';
5
- import { Link } from 'dumi';
5
+ import { Link, FormattedMessage } from 'dumi';
6
6
  import Slider from 'react-slick';
7
7
  import cx from 'classnames';
8
8
  import 'slick-carousel/slick/slick.css';
9
9
  import 'slick-carousel/slick/slick-theme.css';
10
- import { useT, ic } from "../hooks";
10
+ import { ic } from "../hooks";
11
11
  import styles from "./index.module.less";
12
12
  export var Cases = function Cases(_ref) {
13
13
  var _ref$cases = _ref.cases,
@@ -68,10 +68,14 @@ export var Cases = function Cases(_ref) {
68
68
  href: app.link,
69
69
  target: "_blank",
70
70
  rel: "noopener noreferrer"
71
- }, useT('查看详情')) : /*#__PURE__*/React.createElement(Link, {
71
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
72
+ id: "\u67E5\u770B\u8BE6\u60C5"
73
+ })) : /*#__PURE__*/React.createElement(Link, {
72
74
  className: styles.detail,
73
75
  to: app.link ? app.link : ''
74
- }, useT('查看详情')));
76
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
77
+ id: "\u67E5\u770B\u8BE6\u60C5"
78
+ })));
75
79
  return /*#__PURE__*/React.createElement("div", {
76
80
  className: styles.appWrapper,
77
81
  key: ic(app.title)
@@ -21,12 +21,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
21
21
  import React, { useEffect, useState } from 'react';
22
22
  import { CodeSandboxOutlined, PlayCircleOutlined, ThunderboltOutlined } from '@ant-design/icons';
23
23
  import { Typography, Tooltip } from 'antd';
24
- import { useLocale } from 'dumi';
24
+ import { useLocale, FormattedMessage } from 'dumi';
25
25
  import { getParameters } from 'codesandbox/lib/api/define';
26
26
  import stackblitzSdk from '@stackblitz/sdk';
27
27
  import { ping } from "../utils";
28
28
  import { extractImportDeps, getCodeSandboxConfig, getStackblitzConfig, getRiddleConfig } from "./utils";
29
- import { useT } from "../hooks";
30
29
  import styles from "./Toolbar.module.less";
31
30
  var Paragraph = Typography.Paragraph;
32
31
  export var EDITOR_TABS;
@@ -93,20 +92,26 @@ export var Toolbar = function Toolbar(_ref) {
93
92
  name: "data",
94
93
  value: JSON.stringify(riddlePrefillConfig)
95
94
  }), /*#__PURE__*/React.createElement(Tooltip, {
96
- title: useT('在 Riddle 中打开')
95
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
96
+ id: "\u5728 Riddle \u4E2D\u6253\u5F00"
97
+ })
97
98
  }, /*#__PURE__*/React.createElement("input", {
98
99
  type: "submit",
99
100
  value: "Create New Riddle with Prefilled Data",
100
101
  className: styles.riddle
101
102
  }))) : null, /*#__PURE__*/React.createElement(Tooltip, {
102
- title: useT('在 StackBlitz 中打开')
103
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
104
+ id: "\u5728 StackBlitz \u4E2D\u6253\u5F00"
105
+ })
103
106
  }, /*#__PURE__*/React.createElement(ThunderboltOutlined, {
104
107
  className: styles.stackblitz,
105
108
  onClick: function onClick() {
106
109
  stackblitzSdk.openProject(stackblitzPrefillConfig);
107
110
  }
108
111
  })), /*#__PURE__*/React.createElement(Tooltip, {
109
- title: useT('在 CodeSandbox 中打开')
112
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
113
+ id: "\u5728 CodeSandbox \u4E2D\u6253\u5F00"
114
+ })
110
115
  }, /*#__PURE__*/React.createElement("form", {
111
116
  action: "https://codesandbox.io/api/v1/sandboxes/define",
112
117
  method: "POST",
@@ -130,7 +135,9 @@ export var Toolbar = function Toolbar(_ref) {
130
135
  marginLeft: 6
131
136
  }
132
137
  }), /*#__PURE__*/React.createElement(Tooltip, {
133
- title: useT('执行代码')
138
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
139
+ id: "\u6267\u884C\u4EE3\u7801"
140
+ })
134
141
  }, /*#__PURE__*/React.createElement(PlayCircleOutlined, {
135
142
  onClick: onExecuteCode,
136
143
  style: {
@@ -133,10 +133,12 @@ export var CodeEditor = function CodeEditor(_ref) {
133
133
 
134
134
 
135
135
  execute(compiled, containerId, playground === null || playground === void 0 ? void 0 : playground.container, replaceId);
136
- }, 300), [containerId, currentEditorTab]);
136
+ }, 300), [exampleId, currentEditorTab]); // 案例变化的时候,修改期待吗
137
+
137
138
  useEffect(function () {
138
139
  setCode(source);
139
- }, [source]);
140
+ }, [exampleId]); // 代码变化的时候,运行代码
141
+
140
142
  useEffect(function () {
141
143
  executeCode(code);
142
144
  }, [code]);
@@ -149,6 +151,12 @@ export var CodeEditor = function CodeEditor(_ref) {
149
151
  }, 100));
150
152
  }
151
153
 
154
+ return function () {
155
+ dom && clear(dom);
156
+ };
157
+ }, []); // 生命周期
158
+
159
+ useEffect(function () {
152
160
  onReady();
153
161
 
154
162
  if (playground !== null && playground !== void 0 && playground.playgroundDidMount) {
@@ -156,7 +164,6 @@ export var CodeEditor = function CodeEditor(_ref) {
156
164
  }
157
165
 
158
166
  return function () {
159
- dom && clear(dom);
160
167
  onDestroy();
161
168
 
162
169
  if (playground !== null && playground !== void 0 && playground.playgroundWillUnmount) {
@@ -175,16 +182,22 @@ export var CodeEditor = function CodeEditor(_ref) {
175
182
  setEditorTabs([EDITOR_TABS.JAVASCRIPT, EDITOR_TABS.DATA]);
176
183
  setData(data);
177
184
  });
185
+ } else {
186
+ setEditorTabs([EDITOR_TABS.JAVASCRIPT]);
178
187
  }
179
- }, []);
180
- useEffect(function () {
181
- if (monacoRef.current) {
182
- var v = currentEditorTab === EDITOR_TABS.JAVASCRIPT ? code : JSON.stringify(data, null, 2);
183
- monacoRef.current.setValue(v);
184
- }
185
- }, [currentEditorTab]);
186
- var onCodeChange = useCallback(function (value) {
187
- if (currentEditorTab === EDITOR_TABS.JAVASCRIPT) {
188
+ }, [exampleId]); // 切换 tab
189
+
190
+ var onTabChange = useCallback(function (tab) {
191
+ setCurrentEditorTab(tab);
192
+ }, [exampleId]); // useEffect(() => {
193
+ // if (monacoRef.current) {
194
+ // const v = currentEditorTab === EDITOR_TABS.JAVASCRIPT ? code : JSON.stringify(data, null, 2);
195
+ // monacoRef.current.setValue(v);
196
+ // }
197
+ // }, [currentEditorTab]);
198
+
199
+ var onCodeChange = useCallback(function (value, event) {
200
+ if (!event.isFlush && currentEditorTab === EDITOR_TABS.JAVASCRIPT) {
188
201
  setCode(value);
189
202
  }
190
203
  }, [currentEditorTab]);
@@ -202,7 +215,7 @@ export var CodeEditor = function CodeEditor(_ref) {
202
215
  onExecuteCode: function onExecuteCode() {
203
216
  return executeCode(code);
204
217
  },
205
- onEditorTabChange: setCurrentEditorTab,
218
+ onEditorTabChange: onTabChange,
206
219
  onToggleFullscreen: onFullscreen
207
220
  }), /*#__PURE__*/React.createElement("div", {
208
221
  className: styles.monaco,
@@ -210,9 +223,9 @@ export var CodeEditor = function CodeEditor(_ref) {
210
223
  height: 'calc(100% - 36px)'
211
224
  }
212
225
  }, /*#__PURE__*/React.createElement(MonacoEditor, {
213
- language: currentEditorTab === EDITOR_TABS.JAVASCRIPT ? 'javascript' : 'json' // value={currentEditorTab === EDITOR_TABS.JAVASCRIPT ? code : JSON.stringify(data, null, 2)}
226
+ language: currentEditorTab === EDITOR_TABS.JAVASCRIPT ? 'javascript' : 'json',
227
+ value: currentEditorTab === EDITOR_TABS.JAVASCRIPT ? code : JSON.stringify(data, null, 2) // defaultValue={code}
214
228
  ,
215
- defaultValue: code,
216
229
  path: relativePath,
217
230
  loading: /*#__PURE__*/React.createElement(Loading, null),
218
231
  options: {
@@ -12,7 +12,7 @@ export var CodeHeader = function CodeHeader(_ref) {
12
12
  ghost: false,
13
13
  title: title // todo 编辑地址各种各样,需要有单独的配置,暂时关闭!
14
14
  // subTitle={
15
- // <Tooltip title={useT('在 GitHub 上编辑')}>
15
+ // <Tooltip title={<FormattedMessage id="在 GitHub 上编辑" />}>
16
16
  // <a
17
17
  // href={getGithubSourceURL(githubUrl, relativePath, 'examples')}
18
18
  // target="_blank"
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Result } from 'antd';
3
- import { useT } from "../hooks";
3
+ import { FormattedMessage } from 'dumi';
4
4
  import styles from "./index.module.less";
5
5
 
6
6
  function getErrorMessage(e) {
@@ -30,7 +30,9 @@ export var CodePreview = function CodePreview(_ref) {
30
30
  }), error ? /*#__PURE__*/React.createElement(Result, {
31
31
  className: styles.result,
32
32
  status: "error",
33
- title: useT('演示代码报错,请检查'),
33
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
34
+ id: "\u6F14\u793A\u4EE3\u7801\u62A5\u9519\uFF0C\u8BF7\u68C0\u67E5"
35
+ }),
34
36
  subTitle: /*#__PURE__*/React.createElement("pre", null, getErrorMessage(error))
35
37
  }) : null));
36
38
  };
@@ -19,6 +19,7 @@ import { CodePreview } from "../CodePreview";
19
19
  import { CodeHeader } from "../CodePreview/CodeHeader";
20
20
  import { getDemoInfo } from "./utils";
21
21
  import { NotFound } from "../404";
22
+ import { ic } from "../hooks";
22
23
 
23
24
  /**
24
25
  * 代码编辑器 + 代码预览区域
@@ -58,7 +59,7 @@ export var CodeRunner = function CodeRunner(_ref) {
58
59
 
59
60
  var locale = useLocale();
60
61
  var header = /*#__PURE__*/React.createElement(CodeHeader, {
61
- title: title[locale.id],
62
+ title: ic(title),
62
63
  relativePath: relativePath,
63
64
  githubUrl: githubUrl
64
65
  });
@@ -4,7 +4,7 @@ declare type Company = {
4
4
  img: string;
5
5
  };
6
6
  interface CompaniesProps {
7
- title: string;
7
+ title: any;
8
8
  companies: Company[];
9
9
  className?: string;
10
10
  style?: React.CSSProperties;