Skip to content

Commit 868e190

Browse files
committed
feat(contextview): add more contextview demo
1 parent 01ab91f commit 868e190

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

stories/components/8-ContextView.stories.tsx

+39-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import * as React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import { withKnobs } from '@storybook/addon-knobs';
4-
import { propsTable } from '../common/propsTable';
5-
4+
import { Select, Option } from 'mo/components/select';
65
import { useContextView } from 'mo/components/contextview';
6+
import { Menu, MenuMode, MenuItem, SubMenu } from 'mo/components/menu';
7+
8+
import { propsTable } from '../common/propsTable';
79

810
const stories = storiesOf('ContextView', module);
911
stories.addDecorator(withKnobs);
@@ -48,8 +50,6 @@ stories.add(
4850
position: 'relative',
4951
width: 200,
5052
height: 200,
51-
top: 0,
52-
left: 0,
5353
margin: 'auto',
5454
background: '#dddddd',
5555
};
@@ -61,10 +61,44 @@ stories.add(
6161
ContextView
6262
组件主要是提供了一个可根据指定锚点位置、渲染内容的视图容器。
6363
</p>
64-
<h2>使用示例</h2>
64+
<h2>使用示例 - 1</h2>
6565
<div id="topLeft" onClick={show} style={styled}>
6666
Click me!
6767
</div>
68+
<div>
69+
<h2>使用示例 - 2</h2>
70+
<Select
71+
id="demo2"
72+
key="demo2"
73+
style={{
74+
width: 200,
75+
color: 'rgba(255, 255, 255, 0.4)',
76+
background: '#252526',
77+
}}
78+
placeholder="请选择"
79+
>
80+
<Option value="1">option - 1</Option>
81+
<Option value="2">option - 2</Option>
82+
<Option value="3">option - 3</Option>
83+
<Option value="4" description="Test option one">
84+
option - 4
85+
</Option>
86+
</Select>
87+
</div>
88+
<div>
89+
<h2>使用示例 - 3</h2>
90+
<Menu style={{ width: 200 }}>
91+
<MenuItem>menuItem1</MenuItem>
92+
<MenuItem>menuItem2</MenuItem>
93+
<MenuItem>menuItem3</MenuItem>
94+
<SubMenu mode={MenuMode.Vertical} name={'menuItem4'}>
95+
<MenuItem>subMenuItem1</MenuItem>
96+
<MenuItem>subMenuItem2</MenuItem>
97+
<MenuItem>subMenuItem3</MenuItem>
98+
<MenuItem>subMenuItem4</MenuItem>
99+
</SubMenu>
100+
</Menu>
101+
</div>
68102
</div>
69103
);
70104
},

0 commit comments

Comments
 (0)