Skip to content

Commit

Permalink
feat: stories optimzie
Browse files Browse the repository at this point in the history
stories optimize
  • Loading branch information
zhangtengjin committed Dec 3, 2020
1 parent 93bd10e commit c017b7c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
12 changes: 11 additions & 1 deletion stories/components/2-Collapse.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,14 @@ const sampleFolderPanel = {
},
};

export const Basic = () => <Collapse data={[editorPanel, sampleFolderPanel]} />;
export const Basic = () => {
return <div>
<h2>简述</h2>
<p>
Collapse
可以折叠/展开的内容区域。
</p>
<h3>使用示例 尝试点击下方面板看看~</h3>
<Collapse data={[editorPanel, sampleFolderPanel]} />;
</div>
}
41 changes: 19 additions & 22 deletions stories/components/4-Tree.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import * as React from 'react';
import { useState } from 'react';
import Tree from 'mo/components/tree';
import Tree, { ITreeNodeItem, FileTypes, FileType } from 'mo/components/tree';
import { storiesOf } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
const stories = storiesOf('Tree', module);
stories.addDecorator(withKnobs);

const folder = FileTypes.FOLDER as FileType;
const file = FileTypes.FILE as FileType;

stories.add('Basic Usage', () => {
const data = [
{
id: '1',
title: 'folder',
name: 'folder',
key: 'folder',
type: 'folder',
name: folder,
type: folder,
contextMenu: [
{
id: 'custom',
Expand All @@ -26,52 +27,48 @@ stories.add('Basic Usage', () => {
children: [
{
id: '2',
title: 'abccccccccc',
name: 'abccccccccc',
key: 'abccccccccc',
type: 'folder',
name: 'abc',
type: folder,
children: [
{
id: '3',
title: 'test.txt',
name: 'test.txt',
key: 'test.txt',
type: 'file',
type: file,
icon: 'symbol-file',
},
],
},
{
id: '6',
title: 'xyz',
name: 'xyz',
key: 'xyz',
type: 'folder',
type: folder,
children: [
{
id: '7',
title: 'test.pdf',
name: 'test.pdf',
key: 'test.pdf',
type: 'file',
type: file,
icon: 'file-pdf',
},
],
},
{
id: '10',
title: 'file.yaml',
name: 'file.yaml',
key: 'file.yaml',
type: 'file',
type: file,
},
],
},
];

const [treeData, setTreeData] = useState<any>(data);
const [treeData, setTreeData] = useState<ITreeNodeItem[]>(data);
return (
<div>
<h2>简述</h2>
<p>
Tree
多层次的结构列表。实现组件拖拽、右键面板等简单功能
</p>
<h3>使用示例 尝试点击面板或者右键看看~</h3>
<Tree prefixCls="rc-tree" data={treeData} />
</div>
);
Expand Down

0 comments on commit c017b7c

Please sign in to comment.