@antv/dumi-theme-antv 0.1.0

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.
Files changed (111) hide show
  1. package/README.md +9 -0
  2. package/es/antv/404/index.js +20 -0
  3. package/es/antv/Banner/Banner.module.less +412 -0
  4. package/es/antv/Banner/Notification.js +44 -0
  5. package/es/antv/Banner/Notification.module.less +108 -0
  6. package/es/antv/Banner/index.js +115 -0
  7. package/es/antv/Cases/Cases.js +124 -0
  8. package/es/antv/Cases/Cases.module.less +203 -0
  9. package/es/antv/Features/FeatureCard.js +25 -0
  10. package/es/antv/Features/FeatureCard.module.less +51 -0
  11. package/es/antv/Features/Features.module.less +169 -0
  12. package/es/antv/Features/index.js +102 -0
  13. package/es/antv/Footer/Footer.module.less +36 -0
  14. package/es/antv/Footer/index.js +232 -0
  15. package/es/antv/Header/Logo.js +130 -0
  16. package/es/antv/Products/Product.js +61 -0
  17. package/es/antv/Products/Product.module.less +146 -0
  18. package/es/antv/Products/getNewProducts.js +41 -0
  19. package/es/antv/Products/getProducts.js +466 -0
  20. package/es/antv/Products/index.js +81 -0
  21. package/es/antv/hooks.js +81 -0
  22. package/es/antv/mixins.less +21 -0
  23. package/es/antv/utils.js +49 -0
  24. package/es/builtins/API.js +37 -0
  25. package/es/builtins/Alert.js +9 -0
  26. package/es/builtins/Alert.less +62 -0
  27. package/es/builtins/Badge.js +9 -0
  28. package/es/builtins/Badge.less +31 -0
  29. package/es/builtins/Example.js +48 -0
  30. package/es/builtins/Example.less +47 -0
  31. package/es/builtins/Previewer.js +225 -0
  32. package/es/builtins/Previewer.less +406 -0
  33. package/es/builtins/SourceCode.js +72 -0
  34. package/es/builtins/SourceCode.less +103 -0
  35. package/es/builtins/Table.js +56 -0
  36. package/es/builtins/Table.less +43 -0
  37. package/es/builtins/Tree.js +219 -0
  38. package/es/builtins/Tree.less +159 -0
  39. package/es/components/Dark.js +125 -0
  40. package/es/components/Dark.less +121 -0
  41. package/es/components/LocaleSelect.js +53 -0
  42. package/es/components/LocaleSelect.less +59 -0
  43. package/es/components/Navbar.js +155 -0
  44. package/es/components/Navbar.less +180 -0
  45. package/es/components/SearchBar.js +83 -0
  46. package/es/components/SearchBar.less +165 -0
  47. package/es/components/SideMenu.js +99 -0
  48. package/es/components/SideMenu.less +379 -0
  49. package/es/components/SlugList.js +33 -0
  50. package/es/components/SlugList.less +18 -0
  51. package/es/layout.js +276 -0
  52. package/es/style/layout.less +402 -0
  53. package/es/style/markdown.less +240 -0
  54. package/es/style/variables.less +37 -0
  55. package/package.json +58 -0
  56. package/src/antv/404/index.tsx +25 -0
  57. package/src/antv/Banner/Banner.module.less +412 -0
  58. package/src/antv/Banner/Notification.module.less +108 -0
  59. package/src/antv/Banner/Notification.tsx +45 -0
  60. package/src/antv/Banner/index.tsx +121 -0
  61. package/src/antv/Cases/Cases.module.less +203 -0
  62. package/src/antv/Cases/Cases.tsx +116 -0
  63. package/src/antv/Features/FeatureCard.module.less +51 -0
  64. package/src/antv/Features/FeatureCard.tsx +24 -0
  65. package/src/antv/Features/Features.module.less +169 -0
  66. package/src/antv/Features/index.tsx +86 -0
  67. package/src/antv/Footer/Footer.module.less +36 -0
  68. package/src/antv/Footer/index.tsx +272 -0
  69. package/src/antv/Header/Logo.tsx +85 -0
  70. package/src/antv/Products/Product.module.less +146 -0
  71. package/src/antv/Products/Product.tsx +80 -0
  72. package/src/antv/Products/getNewProducts.tsx +53 -0
  73. package/src/antv/Products/getProducts.tsx +626 -0
  74. package/src/antv/Products/index.tsx +70 -0
  75. package/src/antv/hooks.ts +87 -0
  76. package/src/antv/mixins.less +21 -0
  77. package/src/antv/utils.ts +44 -0
  78. package/src/builtins/API.tsx +57 -0
  79. package/src/builtins/Alert.less +62 -0
  80. package/src/builtins/Alert.tsx +4 -0
  81. package/src/builtins/Badge.less +31 -0
  82. package/src/builtins/Badge.tsx +4 -0
  83. package/src/builtins/Example.less +47 -0
  84. package/src/builtins/Example.tsx +34 -0
  85. package/src/builtins/Previewer.less +406 -0
  86. package/src/builtins/Previewer.tsx +264 -0
  87. package/src/builtins/SourceCode.less +103 -0
  88. package/src/builtins/SourceCode.tsx +55 -0
  89. package/src/builtins/Table.less +43 -0
  90. package/src/builtins/Table.tsx +42 -0
  91. package/src/builtins/Tree.less +159 -0
  92. package/src/builtins/Tree.tsx +130 -0
  93. package/src/components/Dark.less +121 -0
  94. package/src/components/Dark.tsx +78 -0
  95. package/src/components/LocaleSelect.less +59 -0
  96. package/src/components/LocaleSelect.tsx +53 -0
  97. package/src/components/Navbar.less +180 -0
  98. package/src/components/Navbar.tsx +152 -0
  99. package/src/components/SearchBar.less +165 -0
  100. package/src/components/SearchBar.tsx +68 -0
  101. package/src/components/SideMenu.less +379 -0
  102. package/src/components/SideMenu.tsx +148 -0
  103. package/src/components/SlugList.less +18 -0
  104. package/src/components/SlugList.tsx +20 -0
  105. package/src/layout.tsx +225 -0
  106. package/src/style/layout.less +402 -0
  107. package/src/style/markdown.less +240 -0
  108. package/src/style/variables.less +37 -0
  109. package/src/test/SearchBar.test.ts +32 -0
  110. package/src/test/Table.test.tsx +41 -0
  111. package/src/test/index.test.tsx +377 -0
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # dumi-theme-antv
2
+
3
+ dumi theme for antv site
4
+
5
+ ## install
6
+
7
+ ```
8
+ yarn add @antv/dumi-theme-antv --save-dev
9
+ ```
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { HomeOutlined } from '@ant-design/icons';
3
+ import { Result, Button } from 'antd';
4
+ import { Link } from 'dumi/theme';
5
+
6
+ var NotFoundPage = function NotFoundPage() {
7
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Result // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ , {
9
+ status: '404',
10
+ title: "404",
11
+ subTitle: "Sorry, the page you visited does not exist.",
12
+ extra: /*#__PURE__*/React.createElement(Link, {
13
+ to: "/"
14
+ }, /*#__PURE__*/React.createElement(Button, {
15
+ type: "primary"
16
+ }, /*#__PURE__*/React.createElement(HomeOutlined, null), "Back Home"))
17
+ }));
18
+ };
19
+
20
+ export default NotFoundPage;
@@ -0,0 +1,412 @@
1
+ @import '../mixins';
2
+ .container1440() {
3
+ width: 1440px;
4
+ max-width: calc(100% - 80px);
5
+ margin-left: auto;
6
+ margin-right: auto;
7
+
8
+ @media only screen and (max-width: 931.99px) {
9
+ & {
10
+ max-width: calc(100% - 60px);
11
+ }
12
+ }
13
+
14
+ @media only screen and (max-width: 767.99px) {
15
+ & {
16
+ max-width: calc(100% - 32px);
17
+ }
18
+ }
19
+ }
20
+
21
+ .wrapper {
22
+ min-height: 650px;
23
+ max-height: 803px;
24
+ background: linear-gradient(225deg, #ffffff, #f0f5ff);
25
+ height: calc(94vh);
26
+ position: relative;
27
+ overflow: hidden;
28
+ .content {
29
+ .container1440;
30
+ height: 100%;
31
+ position: relative;
32
+ }
33
+ .text {
34
+ position: relative;
35
+ top: 26%;
36
+ z-index: 1;
37
+ margin-left: 4.5%;
38
+ .title {
39
+ font-size: 3.4em; //2.875em;
40
+ font-weight: 800;
41
+ color: rgba(0, 0, 0, 1);
42
+ position: relative;
43
+ }
44
+ .description {
45
+ margin-top: 0.83%; //12px;
46
+ margin-bottom: 0px;
47
+ color: rgba(106, 123, 140, 1);
48
+ font-size: 1.14em;
49
+ font-weight: 200;
50
+ position: relative;
51
+ width: 40%;
52
+ max-width: 700px;
53
+ }
54
+ .buttons {
55
+ display: flex;
56
+ margin-top: 5.56%;
57
+
58
+ .buttonLink + .buttonLink {
59
+ margin-left: 16px;
60
+ }
61
+
62
+ .buttonLink {
63
+ cursor: pointer;
64
+ border-radius: 50px;
65
+ min-width: 134px;
66
+ padding-left: 15px;
67
+ padding-right: 15px;
68
+ height: 40px;
69
+ z-index: 10;
70
+ position: relative;
71
+ transition: all 0.3s;
72
+ border: 1px solid @primary-color;
73
+ color: @primary-color;
74
+ background: transparent;
75
+ text-align: center;
76
+ font-size: 1.14em;
77
+ line-height: 40px;
78
+
79
+ &:hover {
80
+ color: tint(@primary-color, 25%);
81
+ border: 1px solid tint(@primary-color, 25%);
82
+ background-color: fade(@primary-color, 3%);
83
+ }
84
+
85
+ &.primary {
86
+ border: none;
87
+ outline: none;
88
+ color: #fff;
89
+ background: linear-gradient(60deg, fade(@primary-color, 70%), shade(@primary-color, 20%));
90
+ opacity: 0.8;
91
+ box-shadow: 0 8px 10px fade(@primary-color, 20%);
92
+
93
+ &:hover {
94
+ opacity: 1;
95
+ }
96
+ }
97
+ }
98
+ .videoButtonWrapper {
99
+ margin-left: 16px;
100
+ width: fit-content;
101
+ height: fit-content;
102
+ .videoButton {
103
+ width: 40px;
104
+ height: 40px;
105
+ background-size: contain;
106
+ border: 1px solid @primary-color;
107
+ border-radius: 20px;
108
+ transition: all 0.15s;
109
+ display: flex;
110
+ cursor: pointer;
111
+ overflow: hidden;
112
+ .videoButtonIcon {
113
+ margin-left: 12px;
114
+ font-size: 16px;
115
+ color: @primary-color;
116
+ line-height: 44px;
117
+ }
118
+ .videoButtonText {
119
+ line-height: 40px;
120
+ margin-left: 10px;
121
+ color: @primary-color;
122
+ }
123
+ &:hover {
124
+ width: 134px;
125
+ }
126
+ }
127
+ }
128
+ .githubWrapper {
129
+ margin-left: 16px;
130
+ display: flex;
131
+ :global {
132
+ .gh-btn {
133
+ width: 40px;
134
+ height: 40px;
135
+ border-radius: 20px;
136
+ padding: 9px;
137
+ border: 1px solid #ced4d9;
138
+ background: transparent;
139
+ text-decoration: none;
140
+ white-space: nowrap;
141
+ display: flex;
142
+ cursor: pointer;
143
+ float: left;
144
+ transition: all 0.15s;
145
+ &:hover {
146
+ background: #f2f4f5;
147
+ }
148
+ .gh-ico {
149
+ width: 16px;
150
+ height: 16px;
151
+ margin-left: 2px;
152
+ margin-top: 2px;
153
+ background-image: url(https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*Nk9mQ48ZoZMAAAAAAAAAAABkARQnAQ);
154
+ background-size: 100% 100%;
155
+ background-repeat: no-repeat;
156
+ box-sizing: border-box;
157
+ cursor: pointer;
158
+ color: #333;
159
+ }
160
+ .gh-text {
161
+ display: none;
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
+ &:hover {
177
+ background: #f2f4f5;
178
+ transition: all 0.15s;
179
+ }
180
+ }
181
+ .gh-count:hover,
182
+ .gh-count:focus {
183
+ color: #4183c4;
184
+ }
185
+ .gh-count:before,
186
+ .gh-count:after {
187
+ content: '';
188
+ position: absolute;
189
+ display: inline-block;
190
+ width: 0;
191
+ height: 0;
192
+ border-color: transparent;
193
+ border-style: solid;
194
+ }
195
+ .gh-count:before {
196
+ top: 50%;
197
+ left: -3px;
198
+ margin-top: -5px;
199
+ border-width: 4px 4px 4px 0;
200
+ border-right-color: #fafafa;
201
+ }
202
+ .gh-count:after {
203
+ top: 50%;
204
+ border-width: 5px 5px 5px 0;
205
+ border-right-color: #d4d4d4;
206
+ left: -5px;
207
+ z-index: -1;
208
+ margin-top: -6px;
209
+ }
210
+ }
211
+ }
212
+ }
213
+ }
214
+ .notifications {
215
+ width: 80%;
216
+ display: flex;
217
+ bottom: 40px;
218
+ position: absolute;
219
+ z-index: 3;
220
+ margin-left: 4.5%;
221
+ }
222
+ .teaser {
223
+ display: flex;
224
+ position: absolute;
225
+ right: 0;
226
+ margin-top: -300px;
227
+ width: 52%;
228
+ max-width: 598px;
229
+ height: 324px;
230
+ margin: auto;
231
+ margin-top: 0;
232
+ top: 0;
233
+ bottom: 0;
234
+ .teaserimg {
235
+ width: 100%;
236
+ height: auto;
237
+ position: relative;
238
+ }
239
+ }
240
+ .backLeftBottom {
241
+ position: absolute;
242
+ left: -8%;
243
+ bottom: -20px;
244
+ }
245
+ }
246
+ .videoModal {
247
+ :global {
248
+ .video-react-big-play-button {
249
+ display: none !important;
250
+ }
251
+ .video-react-control-bar {
252
+ border-radius: 0 0 4px 4px;
253
+ }
254
+ .video-react {
255
+ border-radius: 4px;
256
+ .video-react-video {
257
+ border-radius: 4px;
258
+ }
259
+ }
260
+ .ant-modal-close {
261
+ right: -50px;
262
+ top: -12px;
263
+ color: #fff;
264
+ }
265
+ .anticon-info-circle {
266
+ display: none !important;
267
+ }
268
+ .ant-modal-confirm-btns {
269
+ display: none !important;
270
+ }
271
+ .ant-modal-confirm-title {
272
+ display: none !important;
273
+ }
274
+ .ant-modal-close {
275
+ display: block !important;
276
+ }
277
+ .ant-modal-body {
278
+ padding: 0 !important;
279
+ .ant-modal-confirm-content {
280
+ margin: 0 !important;
281
+ }
282
+ }
283
+ }
284
+ }
285
+
286
+ @media (max-width: 1144px) {
287
+ .wrapper {
288
+ .teaser {
289
+ transition: 0.3s all;
290
+ margin: auto;
291
+ margin-top: 0;
292
+ top: 0;
293
+ bottom: 0;
294
+ }
295
+ }
296
+ }
297
+
298
+ @media (max-width: 900px) {
299
+ .wrapper {
300
+ .content {
301
+ width: 91.46%;
302
+ margin-left: 4.27%;
303
+ margin-bottom: 5%;
304
+ position: relative;
305
+ }
306
+ .text {
307
+ top: 16.7%;
308
+ text-align: center;
309
+ margin-left: 0;
310
+ .title {
311
+ font-size: 2.857em;
312
+ margin-left: 0;
313
+ }
314
+ .description {
315
+ width: 100%;
316
+ max-width: 100%;
317
+ margin-left: 0;
318
+ font-size: 1em;
319
+ }
320
+ .buttons {
321
+ display: inline-flex;
322
+ .more {
323
+ font-size: 1em;
324
+ }
325
+ .githubIframe {
326
+ height: 40px;
327
+ }
328
+ .videoButtonWrapper {
329
+ width: fit-content;
330
+ height: fit-content;
331
+ }
332
+ }
333
+ }
334
+ .notifications {
335
+ width: 100%;
336
+ display: block;
337
+ bottom: 20px;
338
+ height: 44px;
339
+ overflow: hidden;
340
+ }
341
+ .teaser {
342
+ width: 100%;
343
+ max-width: 1200px;
344
+ margin-top: auto;
345
+ margin-left: unset;
346
+ margin-right: unset;
347
+ right: unset;
348
+ top: 30%;
349
+ display: flex;
350
+ justify-content: center;
351
+ .teaserimg {
352
+ width: 40%;
353
+ margin-left: unset;
354
+ margin-right: unset;
355
+ }
356
+ }
357
+ }
358
+ }
359
+
360
+ @media (max-width: 786px) {
361
+ .wrapper {
362
+ .text {
363
+ .buttons {
364
+ .videoButtonWrapper {
365
+ display: none;
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+
372
+ @media (max-width: 510px) {
373
+ .wrapper {
374
+ .text {
375
+ .buttons {
376
+ margin-top: 70%;
377
+ .githubWrapper {
378
+ display: none;
379
+ }
380
+ }
381
+ }
382
+ .teaser {
383
+ width: 100%;
384
+ top: 5%;
385
+ .teaserimg {
386
+ width: 100%;
387
+ }
388
+ }
389
+ .backLeftBottom {
390
+ display: none;
391
+ }
392
+ }
393
+ }
394
+ @media (max-width: 480px) {
395
+ .wrapper {
396
+ .text {
397
+ height: 70%;
398
+ .buttons {
399
+ bottom: 10px;
400
+ margin-top: unset;
401
+ z-index: 1;
402
+ position: absolute;
403
+ left: 0;
404
+ width: 100%;
405
+ justify-content: center;
406
+ }
407
+ }
408
+ .teaser {
409
+ top: 14%;
410
+ }
411
+ }
412
+ }
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { Link } from 'react-router-dom'; // @ts-ignore
3
+
4
+ import styles from './Notification.module.less';
5
+ var numberImages = ['https://gw.alipayobjects.com/zos/antfincdn/IqREAm36K7/1.png', 'https://gw.alipayobjects.com/zos/antfincdn/3fG1Iqjfnz/2.png'];
6
+
7
+ var Notification = function Notification(_ref) {
8
+ var _ref$index = _ref.index,
9
+ index = _ref$index === void 0 ? 0 : _ref$index,
10
+ type = _ref.type,
11
+ title = _ref.title,
12
+ date = _ref.date,
13
+ _ref$link = _ref.link,
14
+ link = _ref$link === void 0 ? '' : _ref$link;
15
+ var children = /*#__PURE__*/React.createElement("div", {
16
+ className: styles.container
17
+ }, /*#__PURE__*/React.createElement("img", {
18
+ className: styles.number,
19
+ src: numberImages[index],
20
+ alt: index.toString()
21
+ }), /*#__PURE__*/React.createElement("div", {
22
+ className: styles.content
23
+ }, /*#__PURE__*/React.createElement("p", {
24
+ className: styles.description
25
+ }, type, " \u2027 ", title), /*#__PURE__*/React.createElement("p", {
26
+ className: styles.date
27
+ }, date)));
28
+
29
+ if (link.startsWith('http')) {
30
+ return /*#__PURE__*/React.createElement("a", {
31
+ href: link,
32
+ target: "_blank",
33
+ rel: "noopener noreferrer",
34
+ className: styles.notification
35
+ }, children);
36
+ }
37
+
38
+ return /*#__PURE__*/React.createElement(Link, {
39
+ to: link,
40
+ className: styles.notification
41
+ }, children);
42
+ };
43
+
44
+ export default Notification;
@@ -0,0 +1,108 @@
1
+ .notification {
2
+ width: 50%;
3
+ margin-right: 2%;
4
+
5
+ &:last-child {
6
+ margin-right: 0;
7
+ }
8
+
9
+ .container {
10
+ height: 44px;
11
+ display: flex;
12
+ .number {
13
+ height: 100%;
14
+ width: 44px;
15
+ }
16
+ .content {
17
+ padding-left: 20px;
18
+ color: rgba(49, 70, 89, 1);
19
+ text-align: left;
20
+ .description {
21
+ top: 0;
22
+ font-size: 1.14em;
23
+ margin-bottom: 0;
24
+ transition: all 0.3s;
25
+ }
26
+ .date {
27
+ color: rgba(216, 203, 249, 1);
28
+ bottom: 0;
29
+ font-size: 1em;
30
+ margin-top: 4px;
31
+ margin-bottom: 0;
32
+ }
33
+ }
34
+ }
35
+
36
+ &:hover .description {
37
+ color: rgba(89, 126, 247, 1);
38
+ }
39
+ }
40
+
41
+ @media (max-width: 900px) {
42
+ .notification {
43
+ position: absolute;
44
+ width: 100%;
45
+
46
+ &:nth-child(1) {
47
+ animation: showAndHide0 6s infinite;
48
+ }
49
+
50
+ &:nth-child(2) {
51
+ top: 44px;
52
+ animation: showAndHide1 6s infinite;
53
+ }
54
+ }
55
+ }
56
+
57
+ @media (max-width: 768px) {
58
+ .notification {
59
+ width: 100%;
60
+ }
61
+ }
62
+
63
+ @keyframes showAndHide0 {
64
+ 0% {
65
+ opacity: 1;
66
+ top: 0px;
67
+ }
68
+ 33.3% {
69
+ opacity: 1;
70
+ top: 0px;
71
+ }
72
+ 50% {
73
+ opacity: 0;
74
+ top: -30px;
75
+ }
76
+ 83.3% {
77
+ opacity: 0;
78
+ top: 30px;
79
+ }
80
+ 100% {
81
+ opacity: 1;
82
+ top: 0px;
83
+ }
84
+ }
85
+
86
+ /* Standard syntax */
87
+ @keyframes showAndHide1 {
88
+ 0% {
89
+ opacity: 0;
90
+ top: 30px;
91
+ }
92
+ 33.3% {
93
+ opacity: 0;
94
+ top: 30px;
95
+ }
96
+ 50% {
97
+ opacity: 1;
98
+ top: 0px;
99
+ }
100
+ 83.3% {
101
+ opacity: 1;
102
+ top: 0px;
103
+ }
104
+ 100% {
105
+ opacity: 0;
106
+ top: -30px;
107
+ }
108
+ }
@@ -0,0 +1,115 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
8
+
9
+ /* eslint-disable react/no-array-index-key */
10
+
11
+ /* eslint-disable @typescript-eslint/no-explicit-any */
12
+ import React, { useContext } from 'react';
13
+ import GitHubButton from 'react-github-button';
14
+ import gh from 'parse-github-url';
15
+ import classNames from 'classnames';
16
+ import { context } from 'dumi/theme'; // @ts-ignore
17
+
18
+ import styles from './Banner.module.less';
19
+ import Notification from './Notification';
20
+ var backLeftBottom = 'https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg';
21
+
22
+ var Banner = function Banner(_ref) {
23
+ var coverImage = _ref.coverImage,
24
+ title = _ref.title,
25
+ description = _ref.description,
26
+ notifications = _ref.notifications,
27
+ _ref$style = _ref.style,
28
+ style = _ref$style === void 0 ? {} : _ref$style,
29
+ className = _ref.className,
30
+ _ref$showGithubStars = _ref.showGithubStars,
31
+ showGithubStars = _ref$showGithubStars === void 0 ? true : _ref$showGithubStars,
32
+ _ref$buttons = _ref.buttons,
33
+ buttons = _ref$buttons === void 0 ? [] : _ref$buttons;
34
+
35
+ var _useContext = useContext(context),
36
+ repository = _useContext.config.repository;
37
+
38
+ var githubUrl = repository.url;
39
+ var notificationsNode = notifications.slice(0, 2).map(function (notification, i) {
40
+ return /*#__PURE__*/React.createElement(Notification, _extends({
41
+ index: i,
42
+ key: i
43
+ }, notification));
44
+ });
45
+ var renderButtons = buttons.map(function (button, i) {
46
+ var ButtonLink = 'a';
47
+ var buttonProps = {};
48
+
49
+ if (button.link.startsWith('http')) {
50
+ buttonProps.target = '_blank';
51
+ buttonProps.rel = 'noopener noreferrer';
52
+ }
53
+
54
+ if (ButtonLink === 'a') {
55
+ buttonProps.href = button.link;
56
+ } else {
57
+ buttonProps.to = button.link;
58
+ }
59
+
60
+ var _button$shape = button.shape,
61
+ shape = _button$shape === void 0 ? 'round' : _button$shape;
62
+ return /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buttonProps, {
63
+ className: classNames(styles.buttonLink, styles[button.type || ''], button.type === 'primary' ? 'primary-button' : 'common-button'),
64
+ key: i,
65
+ style: _objectSpread({
66
+ borderRadius: shape === 'round' ? '1000px' : '4px'
67
+ }, button.style)
68
+ }), /*#__PURE__*/React.createElement("span", {
69
+ className: styles.button
70
+ }, button.text));
71
+ });
72
+
73
+ if (showGithubStars) {
74
+ var githubObj = gh(githubUrl);
75
+
76
+ if (githubObj && githubObj.owner && githubObj.name) {
77
+ renderButtons.push( /*#__PURE__*/React.createElement("div", {
78
+ key: "github",
79
+ className: styles.githubWrapper
80
+ }, /*#__PURE__*/React.createElement(GitHubButton, {
81
+ type: "stargazers",
82
+ size: "large",
83
+ namespace: githubObj.owner,
84
+ repo: githubObj.name
85
+ })));
86
+ }
87
+ }
88
+
89
+ return /*#__PURE__*/React.createElement("section", {
90
+ className: classNames(styles.wrapper, className),
91
+ style: style
92
+ }, /*#__PURE__*/React.createElement("div", {
93
+ className: styles.content
94
+ }, /*#__PURE__*/React.createElement("div", {
95
+ className: styles.text
96
+ }, /*#__PURE__*/React.createElement("div", {
97
+ className: classNames(styles.title, 'banner-title')
98
+ }, title), /*#__PURE__*/React.createElement("div", {
99
+ className: classNames(styles.description, 'banner-description')
100
+ }, description), /*#__PURE__*/React.createElement("div", {
101
+ className: classNames(styles.buttons, 'banner-buttons')
102
+ }, renderButtons)), /*#__PURE__*/React.createElement("div", {
103
+ className: classNames(styles.notifications, 'notifications')
104
+ }, notificationsNode), /*#__PURE__*/React.createElement("div", {
105
+ className: classNames(styles.teaser, 'teaser')
106
+ }, /*#__PURE__*/React.createElement("div", {
107
+ className: classNames(styles.teaserimg, 'teaser-img')
108
+ }, coverImage)), /*#__PURE__*/React.createElement("img", {
109
+ className: styles.backLeftBottom,
110
+ src: backLeftBottom,
111
+ alt: "back"
112
+ })));
113
+ };
114
+
115
+ export default Banner;