-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: auto-generate component list (#2749)
* docs: update graph api docs * feat: auto-generate component list
- Loading branch information
Showing
78 changed files
with
529 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* inline: true | ||
*/ | ||
import { Card, Col, Flex, Row, Tag } from 'antd'; | ||
import React, { Suspense, useMemo } from 'react'; | ||
import { useLocale, useFullSidebarData, useNavigate } from 'dumi'; | ||
|
||
enum ChartType { | ||
PLOT = 'Plot', | ||
GRAPH = 'Graph', | ||
} | ||
|
||
const locales = { | ||
en: { | ||
[ChartType.PLOT]: 'Statistics', | ||
[ChartType.GRAPH]: 'Relations' | ||
}, | ||
zh: { | ||
[ChartType.PLOT]: '统计图', | ||
[ChartType.GRAPH]: '关系图' | ||
}, | ||
}; | ||
|
||
const URLS = ['/options/plots/special', '/options/graphs']; | ||
|
||
export default () => { | ||
const lang = useLocale().id; | ||
const locale = locales[lang]; | ||
const data = useFullSidebarData(); | ||
const navigate = useNavigate(); | ||
|
||
const metas = useMemo(() => URLS.flatMap(url => data[lang === 'zh' ? url : `/en${url}`][0].children) | ||
.filter(meta => meta.frontmatter.category === 'Components').map(meta => ({ | ||
...meta, | ||
...meta.frontmatter, | ||
color: meta.frontmatter.type === ChartType.GRAPH ? "purple" : "volcano" | ||
})).sort((a, b) => a.title.localeCompare(b.title)), [data, lang]); | ||
|
||
return <Suspense fallback={null}> | ||
<Row gutter={[16, 16]}> | ||
{metas.map((meta, index) => <Col span={6} key={index}> | ||
<Card | ||
size="small" | ||
onClick={() => navigate(meta.link)} | ||
hoverable | ||
title={meta.title} | ||
extra={<Tag bordered={false} style={{ borderRadius: 2 }} color={meta.color}>{locale[meta.type]}</Tag>} | ||
style={{ borderRadius: 4 }} | ||
> | ||
<Flex justify="center" align="center"> | ||
<img alt={meta.title} src={meta.cover} height={148} /> | ||
</Flex> | ||
</Card></Col>)} | ||
</Row> | ||
</Suspense > | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.