@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
@@ -0,0 +1,626 @@
1
+ import {
2
+ AreaChartOutlined,
3
+ DingdingOutlined,
4
+ GithubOutlined,
5
+ HistoryOutlined,
6
+ HomeOutlined,
7
+ PieChartOutlined,
8
+ ReadOutlined,
9
+ YuqueOutlined,
10
+ } from "@ant-design/icons";
11
+ import { each } from "lodash";
12
+ import React from "react";
13
+ import { getChinaMirrorHost } from "../utils";
14
+
15
+ const tuple = <T extends string[]>(...args: T) => args;
16
+ const Categories = tuple("basic", "extension", "ecology");
17
+ const Link = tuple("home", "example", "api");
18
+
19
+ export interface ProductItem {
20
+ title: string;
21
+ icon?: React.ReactNode;
22
+ slogan?: string;
23
+ description: string;
24
+ category: typeof Categories[number];
25
+ links?: Array<{
26
+ icon?: React.ReactNode;
27
+ title: React.ReactNode;
28
+ url?: string;
29
+ openExternal?: boolean;
30
+ }>;
31
+ }
32
+
33
+ const ANTV_DOMAIN = "antv.vision";
34
+
35
+ export type ValuesOf<T extends any[]> = T[number];
36
+
37
+ export const getProducts = ({
38
+ t,
39
+ language,
40
+ isChinaMirrorHost = false,
41
+ }: {
42
+ t: (key: string) => string;
43
+ language: string;
44
+ isChinaMirrorHost?: boolean;
45
+ }): ProductItem[] => {
46
+ const hosts: { [name: string]: string } = {};
47
+ [
48
+ "g2",
49
+ "g2plot",
50
+ "g6",
51
+ "l7",
52
+ "f2",
53
+ "f2native",
54
+ "graphin",
55
+ "g",
56
+ "x6",
57
+ "ava",
58
+ ].forEach((name: string) => {
59
+ hosts[name] = isChinaMirrorHost
60
+ ? getChinaMirrorHost(`${name}.${ANTV_DOMAIN}`)
61
+ : `${name}.${ANTV_DOMAIN}`;
62
+ });
63
+ const products = [
64
+ {
65
+ title: "G2",
66
+ icon:
67
+ "https://gw.alipayobjects.com/zos/antfincdn/trEfLRh5pc/G2%252520keshihuatuxingyufa.svg",
68
+ slogan: t("可视化引擎"),
69
+ description: t("数据驱动,高度易用,可扩展的可视化图形语法。"),
70
+ category: Categories[0],
71
+ links: [
72
+ {
73
+ icon: <HomeOutlined />,
74
+ title: t("产品首页"),
75
+ url: `https://${hosts.g2}/${language}`,
76
+ },
77
+ {
78
+ icon: <PieChartOutlined />,
79
+ title: t("图表示例"),
80
+ url: `https://${hosts.g2}/${language}/examples`,
81
+ },
82
+ {
83
+ icon: <ReadOutlined />,
84
+ title: t("使用文档"),
85
+ url: `https://${hosts.g2}/${language}/docs/manual`,
86
+ },
87
+ {
88
+ icon: <ReadOutlined />,
89
+ title: t("API 文档"),
90
+ url: `https://${hosts.g2}/${language}/docs/api`,
91
+ },
92
+ {
93
+ icon: <HistoryOutlined />,
94
+ title: t("更新日志"),
95
+ url: `https://github.com/antvis/g2/blob/master/CHANGELOG.md`,
96
+ openExternal: true,
97
+ },
98
+ {
99
+ icon: <GithubOutlined />,
100
+ title: t("GitHub 仓库"),
101
+ url: `https://github.com/antvis/g2`,
102
+ openExternal: true,
103
+ },
104
+ {
105
+ icon: "🇨🇳",
106
+ title: t("国内镜像"),
107
+ url: `https://antv-g2.gitee.io`,
108
+ openExternal: true,
109
+ },
110
+ ],
111
+ },
112
+ {
113
+ title: "F2",
114
+ icon:
115
+ "https://gw.alipayobjects.com/zos/antfincdn/D%26fDbWqVkv/F2%252520yidongduankeshihuafangan.svg",
116
+ slogan: t("移动可视化方案"),
117
+ description: t(
118
+ "专注于移动端的可视化解决方案,兼容 H5/小程序/Weex 等多端环境"
119
+ ),
120
+ category: Categories[0],
121
+ links: [
122
+ {
123
+ icon: <HomeOutlined />,
124
+ title: t("产品首页"),
125
+ url: `https://${hosts.f2}/${language}`,
126
+ },
127
+ {
128
+ icon: <PieChartOutlined />,
129
+ title: t("图表示例"),
130
+ url: `https://${hosts.f2}/${language}/examples`,
131
+ },
132
+ {
133
+ icon: <ReadOutlined />,
134
+ title: t("使用文档"),
135
+ url: `https://${hosts.f2}/${language}/docs/tutorial/getting-started`,
136
+ },
137
+ {
138
+ icon: <ReadOutlined />,
139
+ title: t("API 文档"),
140
+ url: `https://${hosts.f2}/${language}/docs/api`,
141
+ },
142
+ {
143
+ icon: <HistoryOutlined />,
144
+ title: t("更新日志"),
145
+ url: `https://github.com/antvis/f2/blob/master/CHANGELOG.md`,
146
+ openExternal: true,
147
+ },
148
+ {
149
+ icon: <GithubOutlined />,
150
+ title: t("GitHub 仓库"),
151
+ url: `https://github.com/antvis/f2`,
152
+ openExternal: true,
153
+ },
154
+ {
155
+ icon: "🇨🇳",
156
+ title: t("国内镜像"),
157
+ url: `https://antv-f2.gitee.io`,
158
+ openExternal: true,
159
+ },
160
+ ],
161
+ },
162
+ {
163
+ title: "G6",
164
+ icon:
165
+ "https://gw.alipayobjects.com/zos/antfincdn/zS1wZZJVcJ/G6%252520tukeshihuayinqing.svg",
166
+ slogan: t("图可视化引擎"),
167
+ description: t("便捷的关系数据可视化引擎与图分析工具。"),
168
+ category: Categories[0],
169
+ links: [
170
+ {
171
+ icon: <HomeOutlined />,
172
+ title: t("产品首页"),
173
+ url: `https://${hosts.g6}/${language}`,
174
+ },
175
+ {
176
+ icon: <PieChartOutlined />,
177
+ title: t("图表示例"),
178
+ url: `https://${hosts.g6}/${language}/examples`,
179
+ },
180
+ {
181
+ icon: <ReadOutlined />,
182
+ title: t("使用文档"),
183
+ url: `https://${hosts.g6}/${language}/docs/manual`,
184
+ },
185
+ {
186
+ icon: <ReadOutlined />,
187
+ title: t("API 文档"),
188
+ url: `https://${hosts.g6}/${language}/docs/api`,
189
+ },
190
+ {
191
+ icon: <HistoryOutlined />,
192
+ title: t("更新日志"),
193
+ url: `https://github.com/antvis/g6/blob/master/CHANGELOG.md`,
194
+ openExternal: true,
195
+ },
196
+ {
197
+ icon: <GithubOutlined />,
198
+ title: t("GitHub 仓库"),
199
+ url: `https://github.com/antvis/g6`,
200
+ openExternal: true,
201
+ },
202
+ {
203
+ icon: "🇨🇳",
204
+ title: t("国内镜像"),
205
+ url: `https://antv-g6.gitee.io`,
206
+ openExternal: true,
207
+ },
208
+ ],
209
+ },
210
+ {
211
+ title: "X6",
212
+ icon:
213
+ "https://gw.alipayobjects.com/zos/bmw-prod/1d5e84d0-d153-4648-81c0-397b3d383d2c.svg",
214
+ slogan: t("图编辑引擎"),
215
+ description: t("极易定制、开箱即用、数据驱动的图编辑引擎"),
216
+ category: Categories[0],
217
+ links: [
218
+ {
219
+ icon: <HomeOutlined />,
220
+ title: t("产品首页"),
221
+ url: `https://${hosts.x6}/${language}`,
222
+ },
223
+ {
224
+ icon: <PieChartOutlined />,
225
+ title: t("图表示例"),
226
+ url: `https://${hosts.x6}/${language}/examples`,
227
+ },
228
+ {
229
+ icon: <ReadOutlined />,
230
+ title: t("使用文档"),
231
+ url: `https://${hosts.x6}/${language}/docs/tutorial/about/`,
232
+ },
233
+ {
234
+ icon: <ReadOutlined />,
235
+ title: t("API 文档"),
236
+ url: `https://${hosts.x6}/${language}/docs/api/graph/`,
237
+ },
238
+ {
239
+ icon: <GithubOutlined />,
240
+ title: t("GitHub 仓库"),
241
+ url: `https://github.com/antvis/x6`,
242
+ openExternal: true,
243
+ },
244
+ {
245
+ icon: "🇨🇳",
246
+ title: t("国内镜像"),
247
+ url: `https://antv-x6.gitee.io`,
248
+ openExternal: true,
249
+ },
250
+ ],
251
+ },
252
+ {
253
+ title: "L7",
254
+ icon:
255
+ "https://gw.alipayobjects.com/zos/antfincdn/OI%26h7HXH33/L7%252520dilikongjianshujukeshihua.svg",
256
+ slogan: t("地理空间数据可视化"),
257
+ description: t("高性能/高渲染质量的地理空间数据可视化框架。"),
258
+ category: Categories[0],
259
+ links: [
260
+ {
261
+ icon: <HomeOutlined />,
262
+ title: t("产品首页"),
263
+ url: `https://${hosts.l7}/${language}`,
264
+ },
265
+ {
266
+ icon: <PieChartOutlined />,
267
+ title: t("图表示例"),
268
+ url: `https://${hosts.l7}/${language}/examples`,
269
+ },
270
+ {
271
+ icon: <ReadOutlined />,
272
+ title: t("使用文档"),
273
+ url: `https://${hosts.l7}/${language}/docs/tutorial`,
274
+ },
275
+ {
276
+ icon: <ReadOutlined />,
277
+ title: t("API 文档"),
278
+ url: `https://${hosts.l7}/${language}/docs/api/l7`,
279
+ },
280
+ {
281
+ icon: <HistoryOutlined />,
282
+ title: t("更新日志"),
283
+ url: `https://github.com/antvis/L7/blob/master/CHANGELOG.md`,
284
+ openExternal: true,
285
+ },
286
+ {
287
+ icon: <GithubOutlined />,
288
+ title: t("GitHub 仓库"),
289
+ url: `https://github.com/antvis/L7`,
290
+ openExternal: true,
291
+ },
292
+ {
293
+ icon: "🇨🇳",
294
+ title: t("国内镜像"),
295
+ url: `https://antv-l7.gitee.io`,
296
+ openExternal: true,
297
+ },
298
+ ],
299
+ },
300
+ {
301
+ title: "G2Plot",
302
+ icon: "https://gw.alipayobjects.com/zos/antfincdn/SlbIagEvT7/G2plot.svg",
303
+ slogan: t("开箱即用的图表库"),
304
+ description: t("开箱即用、易于配置、极致体验的通用图表库。"),
305
+ category: Categories[1],
306
+ links: [
307
+ {
308
+ icon: <HomeOutlined />,
309
+ title: t("产品首页"),
310
+ url: `https://${hosts.g2plot}/${language}`,
311
+ },
312
+ {
313
+ icon: <PieChartOutlined />,
314
+ title: t("图表示例"),
315
+ url: `https://${hosts.g2plot}/${language}/examples`,
316
+ },
317
+ {
318
+ icon: <ReadOutlined />,
319
+ title: t("使用文档"),
320
+ url: `https://${hosts.g2plot}/${language}/docs/manual`,
321
+ },
322
+ {
323
+ icon: <ReadOutlined />,
324
+ title: t("API 文档"),
325
+ url: `https://${hosts.g2plot}/${language}/docs/api`,
326
+ },
327
+ {
328
+ icon: <HistoryOutlined />,
329
+ title: t("更新日志"),
330
+ url: `https://github.com/antvis/g2plot/blob/master/CHANGELOG.md`,
331
+ openExternal: true,
332
+ },
333
+ {
334
+ icon: <GithubOutlined />,
335
+ title: t("GitHub 仓库"),
336
+ url: `https://github.com/antvis/g2plot`,
337
+ openExternal: true,
338
+ },
339
+ {
340
+ icon: "🇨🇳",
341
+ title: t("国内镜像"),
342
+ url: `https://antv-g2plot.gitee.io`,
343
+ openExternal: true,
344
+ },
345
+ ],
346
+ },
347
+
348
+ {
349
+ title: "F2Native",
350
+ icon:
351
+ "https://gw.alipayobjects.com/zos/antfincdn/D%26fDbWqVkv/F2%252520yidongduankeshihuafangan.svg",
352
+ slogan: t("移动可视化方案"),
353
+ description: t(
354
+ "跨平台高性能的移动端可视化解决方案,满足你的各种图表需求。"
355
+ ),
356
+ category: Categories[1],
357
+ links: [
358
+ {
359
+ icon: <HomeOutlined />,
360
+ title: t("产品首页"),
361
+ url: `https://${hosts.f2native}/${language}`,
362
+ },
363
+ {
364
+ icon: <PieChartOutlined />,
365
+ title: t("图表示例"),
366
+ url: `https://${hosts.f2native}/${language}/docs/examples`,
367
+ },
368
+ {
369
+ icon: <ReadOutlined />,
370
+ title: t("使用文档"),
371
+ url: `https://${hosts.f2native}/${language}/docs/tutorial/getting-started`,
372
+ },
373
+ {
374
+ icon: <ReadOutlined />,
375
+ title: t("API 文档"),
376
+ url: `https://${hosts.f2native}/${language}/docs/api/API`,
377
+ },
378
+ {
379
+ icon: <GithubOutlined />,
380
+ title: t("GitHub 仓库"),
381
+ url: `https://github.com/antvis/f2`,
382
+ openExternal: true,
383
+ },
384
+ {
385
+ icon: "🇨🇳",
386
+ title: t("国内镜像"),
387
+ url: `https://antv-f2.gitee.io`,
388
+ openExternal: true,
389
+ },
390
+ ],
391
+ },
392
+
393
+ {
394
+ title: "Graphin",
395
+ icon: "https://gw.alipayobjects.com/zos/antfincdn/0b4HzOcEJY/Graphin.svg",
396
+ slogan: t(""),
397
+ description: t("基于 G6 封装的图分析应用组件。"),
398
+ category: Categories[1],
399
+ links: [
400
+ {
401
+ icon: <HomeOutlined />,
402
+ title: t("产品首页"),
403
+ url: `https://${hosts.graphin}/${language}`,
404
+ },
405
+ {
406
+ icon: <PieChartOutlined />,
407
+ title: t("组件示例"),
408
+ url: `https://${hosts.graphin}/${language}/examples`,
409
+ },
410
+ {
411
+ icon: <ReadOutlined />,
412
+ title: t("使用文档"),
413
+ url: `https://${hosts.graphin}/${language}/docs/manual/introduction`,
414
+ },
415
+ {
416
+ icon: <ReadOutlined />,
417
+ title: t("API 文档"),
418
+ url: `https://${hosts.graphin}/${language}/docs/api/graphin`,
419
+ },
420
+ {
421
+ icon: <HistoryOutlined />,
422
+ title: t("更新日志"),
423
+ url: `https://github.com/antvis/graphin/blob/master/CHANGELOG.md`,
424
+ openExternal: true,
425
+ },
426
+ {
427
+ icon: <GithubOutlined />,
428
+ title: t("GitHub 仓库"),
429
+ url: `https://github.com/antvis/graphin`,
430
+ openExternal: true,
431
+ },
432
+ {
433
+ icon: "🇨🇳",
434
+ title: t("国内镜像"),
435
+ url: `https://antv-graphin.gitee.io`,
436
+ openExternal: true,
437
+ },
438
+ ],
439
+ },
440
+
441
+ {
442
+ title: "AVA",
443
+ icon:
444
+ "https://gw.alipayobjects.com/zos/bmw-prod/1069c628-7460-4b09-a649-0f2ad64dfc78.svg",
445
+ slogan: t(""),
446
+ description: t("AVA 是为了更简便的可视分析而生的技术框架。"),
447
+ category: Categories[1],
448
+ links: [
449
+ {
450
+ icon: <HomeOutlined />,
451
+ title: t("产品首页"),
452
+ url: `https://${hosts.ava}/${language}`,
453
+ },
454
+ {
455
+ icon: <PieChartOutlined />,
456
+ title: t("图表示例"),
457
+ url: `https://${hosts.ava}/${language}/examples`,
458
+ },
459
+ {
460
+ icon: <ReadOutlined />,
461
+ title: t("使用文档"),
462
+ url: `https://${hosts.ava}/${language}/docs/guide`,
463
+ },
464
+ {
465
+ icon: <ReadOutlined />,
466
+ title: t("API 文档"),
467
+ url: `https://${hosts.ava}/${language}/docs/api`,
468
+ },
469
+ {
470
+ icon: <GithubOutlined />,
471
+ title: t("GitHub 仓库"),
472
+ url: `https://github.com/antvis/ava`,
473
+ openExternal: true,
474
+ },
475
+ {
476
+ icon: "🇨🇳",
477
+ title: t("国内镜像"),
478
+ url: `https://antv-ava.gitee.io`,
479
+ openExternal: true,
480
+ },
481
+ ],
482
+ },
483
+ {
484
+ title: "ChartCube",
485
+ icon:
486
+ "https://gw.alipayobjects.com/zos/antfincdn/Zr74jx8YNX/chartcube.svg",
487
+ slogan: t("图表魔方"),
488
+ description: t("AntV 在线图表制作利器。"),
489
+ category: Categories[1],
490
+ links: [
491
+ {
492
+ icon: <HomeOutlined />,
493
+ title: t("产品首页"),
494
+ url: `https://chartcube.alipay.com`,
495
+ openExternal: true,
496
+ },
497
+ {
498
+ icon: <AreaChartOutlined />,
499
+ title: t("生成图表"),
500
+ url: `https://chartcube.alipay.com/guide`,
501
+ openExternal: true,
502
+ },
503
+ {
504
+ icon: <YuqueOutlined />,
505
+ title: t("语雀社区"),
506
+ url: `https://www.yuque.com/chartcube`,
507
+ openExternal: true,
508
+ },
509
+ {
510
+ icon: <DingdingOutlined />,
511
+ title: t("钉钉服务群"),
512
+ url: `dingtalk://dingtalkclient/action/joingroup?cid=8305538734`,
513
+ openExternal: true,
514
+ },
515
+ ],
516
+ },
517
+ {
518
+ title: t("墨者学院"),
519
+ icon:
520
+ "https://gw.alipayobjects.com/zos/antfincdn/12j36RPVldO/mozhexueyuan.svg",
521
+ description: t("数据可视化社团"),
522
+ category: Categories[2],
523
+ links: [
524
+ {
525
+ title: t("学院首页"),
526
+ url: `https://www.yuque.com/mo-college`,
527
+ openExternal: true,
528
+ },
529
+ ],
530
+ },
531
+ {
532
+ title: "BizCharts",
533
+ icon:
534
+ "https://gw.alipayobjects.com/zos/antfincdn/Q1pbg%26O2TM/BizCharts.svg",
535
+ description: t("基于商业场景下的数据可视化解决方案"),
536
+ category: Categories[2],
537
+ links: [
538
+ {
539
+ title: t("产品首页"),
540
+ url: "https://bizcharts.net",
541
+ openExternal: true,
542
+ },
543
+ ],
544
+ },
545
+ {
546
+ title: "Ant Design Charts",
547
+ icon:
548
+ "https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg",
549
+ description: t("基于 G2Plot 实现的 React 可视化图表库"),
550
+ category: Categories[2],
551
+ links: [
552
+ {
553
+ title: t("产品首页"),
554
+ url: `https://charts.ant.design/`,
555
+ openExternal: true,
556
+ },
557
+ ],
558
+ },
559
+ ];
560
+
561
+ return products;
562
+ };
563
+
564
+ const CATEGORY_TYPE = tuple("basic", "extension", "mobile", "ecology");
565
+ export const CATEGORIES: Array<{
566
+ type: typeof CATEGORY_TYPE[number];
567
+ name: string;
568
+ }> = [
569
+ { type: "basic", name: "标准版基础产品" },
570
+ { type: "extension", name: "标准版扩展产品" },
571
+ { type: "mobile", name: "移动定制(F版)产品" },
572
+ { type: "ecology", name: "周边生态" },
573
+ ];
574
+
575
+ export type ProductType = {
576
+ links: {
577
+ /** 产品首页 */
578
+ readonly home?: { url: string; title?: string };
579
+ /** 图表示例 */
580
+ readonly example?: { url: string; title?: string };
581
+ /** 使用文档 */
582
+ readonly api?: { url: string; title?: string };
583
+ };
584
+ [k: string]: any;
585
+ };
586
+
587
+ export function getNewProducts({
588
+ language,
589
+ isChinaMirrorHost,
590
+ }: {
591
+ language: "zh" | "en";
592
+ isChinaMirrorHost: boolean;
593
+ }): Promise<ProductType[]> {
594
+ // 如需要修改产品信息,请到 https://yuyan.antfin-inc.com/datavprod/antv-site-datas/schemas/site-products-h5data/console 修改区块内容
595
+ return fetch(
596
+ "https://render.alipay.com/p/h5data/antv-site-datas_site-products-h5data.json"
597
+ )
598
+ .then((res) => res.json())
599
+ .then((products: ProductType[]) => {
600
+ return products
601
+ .filter((d) => d.lang === language)
602
+ .map((d) => {
603
+ const links =
604
+ typeof d.links === "string" ? JSON.parse(d.links) : { ...d.links };
605
+ const newLinks: any = {};
606
+
607
+ each(links, (value, k: string) => {
608
+ let actualUrl = value?.url || "";
609
+ if (isChinaMirrorHost) {
610
+ // g2plot.antv.vision => antv-g2plot.gitee.io
611
+ const match = actualUrl.match(
612
+ /([http|https]):\/\/(.*)\.antv\.vision/
613
+ );
614
+ if (match && match[2]) {
615
+ actualUrl = actualUrl.replace(
616
+ `${match[2]}.antv.vision`,
617
+ `antv-${match[2]}.gitee.io`
618
+ );
619
+ }
620
+ }
621
+ newLinks[k] = { ...value, url: actualUrl };
622
+ });
623
+ return { ...d, links: newLinks };
624
+ });
625
+ });
626
+ }
@@ -0,0 +1,70 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { useChinaMirrorHost } from "../hooks";
5
+ import { CATEGORIES, getNewProducts, ProductType } from "./getProducts";
6
+ import Product from "./Product";
7
+ //@ts-ignore
8
+ import styles from "./Product.module.less";
9
+
10
+ interface ProductsProps {
11
+ show: boolean;
12
+ rootDomain: string;
13
+ language?: "zh" | "en";
14
+ className?: string;
15
+ }
16
+
17
+ const Products: React.FC<ProductsProps> = ({ show, language, className }) => {
18
+ const { t, i18n } = useTranslation();
19
+ const [isChinaMirrorHost] = useChinaMirrorHost();
20
+ const [products, setProducts] = React.useState<ProductType[]>([]);
21
+
22
+ const lang = i18n.language === "zh" ? "zh" : "en";
23
+ React.useEffect(() => {
24
+ getNewProducts({
25
+ language: lang,
26
+ isChinaMirrorHost,
27
+ }).then((data) => {
28
+ setProducts(data);
29
+ });
30
+ }, [lang, isChinaMirrorHost]);
31
+
32
+ return (
33
+ <>
34
+ <div
35
+ className={classNames(styles.products, className, {
36
+ [styles.show]: !!show,
37
+ })}
38
+ >
39
+ <div className={styles.container}>
40
+ {CATEGORIES.map(({ name, type }, idx) => {
41
+ return (
42
+ <React.Fragment key={idx}>
43
+ <h3>{t(name)}</h3>
44
+ <ul>
45
+ {products
46
+ .filter((item) => item.category === type)
47
+ .map((product) => (
48
+ <Product
49
+ key={product.title}
50
+ name={product.title}
51
+ slogan={product.slogan || ""}
52
+ description={product.description}
53
+ url={product.links?.home?.url}
54
+ icon={product.icon as string}
55
+ links={product.links}
56
+ language={language || i18n.language}
57
+ />
58
+ ))}
59
+ </ul>
60
+ </React.Fragment>
61
+ );
62
+ })}
63
+ </div>
64
+ </div>
65
+ <div className={styles.mask} />
66
+ </>
67
+ );
68
+ };
69
+
70
+ export default Products;