-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: remove full legacy docs * docs: add 1.1 docs structure * docs: add tree builtin component * docs: add basic usage of cn version * docs: add advanced usage of cn version * docs: add theme list of cn version * docs: add theme development of cn version * docs: add theme api of cn version * docs: add base en (#420) * docs: add base en * fix: modal demo * fix: add theme url * Update docs/guide/basic.md Co-authored-by: Peach <scdzwyxst@gmail.com> * Update docs/guide/basic.zh-CN.md * Update docs/guide/basic.md Co-authored-by: Peach <scdzwyxst@gmail.com> * docs: add advanced en (#421) * docs: add advanced en * Update docs/guide/advanced.md Co-authored-by: Peach <scdzwyxst@gmail.com> * fix: link url * fix: link * Update docs/guide/advanced.md Co-authored-by: Peach <scdzwyxst@gmail.com> Co-authored-by: Peach <scdzwyxst@gmail.com> * docs: add theme en (#423) * docs: add theme en * docs: update * docs: add lab of cn version * docs: add lab en (#426) * docs: add plugin of cn version * docs: add plugin en (#428) * docs: support to sync docs from umi * docs: add config of cn version * docs: add frontmatter of cn version * docs: complete mode, navs, menus in config * docs: add guide of cn version * docs: add homepage of cn version * docs: add frontmatter (#455) * docs: add legacy faq * docs: add introducation (#456) * docs: add Introducation * Update docs/guide/index.md Co-authored-by: Peach <scdzwyxst@gmail.com> * docs: add config of en version (#454) * docs: make doc sync script can be running inside gh actions * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/basic.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/basic.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/basic.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/basic.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/basic.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/basic.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * Update docs/guide/advanced.md Co-authored-by: 野迂迂 <yangwei1@outlook.com> * docs: add home * style: perf who using * style: fix * docs: hide umi words in homepage * perf: readFileSync * fix: utf8 * docs: use assets meta data instead of umi ui Co-authored-by: xrkffgg <xrkffgg@gmail.com> Co-authored-by: xrkffgg <xrkffgg@vip.qq.com> Co-authored-by: ajuner <53512912+ajuner@users.noreply.github.com> Co-authored-by: 野迂迂 <yangwei1@outlook.com>
- Loading branch information
1 parent
0d8b2d3
commit 89bdc0d
Showing
85 changed files
with
3,053 additions
and
3,126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@import (reference) '~dumi-theme-default/src/style/variables.less'; | ||
|
||
.__dumi-site-tree { | ||
padding: 16px; | ||
border: 1px solid @c-border; | ||
border-radius: 2px; | ||
background-color: @c-light-bg; | ||
|
||
small { | ||
padding-left: 24px; | ||
font-size: 14px; | ||
color: @c-secondary; | ||
|
||
&::before { | ||
content: '# '; | ||
} | ||
} | ||
|
||
.ant-tree-switcher { | ||
background: transparent; | ||
} | ||
} |
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,58 @@ | ||
import React, { useEffect, useState, ReactNode, ComponentProps } from 'react'; | ||
import { Tree } from 'antd'; | ||
import { TreeProps } from 'antd/es/tree'; | ||
import './Tree.less'; | ||
|
||
function getTreeFromList(nodes: ReactNode, prefix = '') { | ||
const data: TreeProps['treeData'] = []; | ||
|
||
[].concat(nodes).forEach((node, i) => { | ||
const key = `${prefix ? `${prefix}-` : ''}${i}`; | ||
|
||
switch (node.type) { | ||
case 'ul': | ||
const parent = data[data.length - 1]?.children || data; | ||
const ulLeafs = getTreeFromList(node.props.children || [], key); | ||
|
||
parent.push(...ulLeafs); | ||
break; | ||
|
||
case 'li': | ||
const liLeafs = getTreeFromList(node.props.children, key); | ||
|
||
data.push({ | ||
title: [].concat(node.props.children).filter(child => child.type !== 'ul'), | ||
key, | ||
children: liLeafs, | ||
isLeaf: !liLeafs.length, | ||
}); | ||
break; | ||
|
||
default: | ||
} | ||
}); | ||
|
||
return data; | ||
} | ||
|
||
const useListToTree = (nodes: ReactNode) => { | ||
const [tree, setTree] = useState(getTreeFromList(nodes)); | ||
|
||
useEffect(() => { | ||
setTree(getTreeFromList(nodes)); | ||
}, [nodes]); | ||
|
||
return tree; | ||
}; | ||
|
||
export default (props: ComponentProps<'div'>) => { | ||
const data = useListToTree(props.children); | ||
|
||
return <Tree.DirectoryTree | ||
className="__dumi-site-tree" | ||
showLine={{ showLeafIcon: false }} | ||
selectable={false} | ||
treeData={[{ key: '0', title: props.title || '<root>', children: data }]} | ||
defaultExpandAll | ||
/>; | ||
}; |
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 |
---|---|---|
|
@@ -19,3 +19,4 @@ dist | |
.umi-production | ||
.umi-test | ||
.now | ||
/docs/.upstream |
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
File renamed without changes.
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
File renamed without changes.
Binary file not shown.
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.