Skip to content

Commit 607a46f

Browse files
committed
feat: add dropDown menu to menuBar
1 parent 419a39a commit 607a46f

File tree

1 file changed

+114
-1
lines changed

1 file changed

+114
-1
lines changed

src/workbench/menuBar/menuBar.tsx

+114-1
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,134 @@ import 'mo/workbench/menuBar/style.scss';
22
import * as React from 'react';
33
import { prefixClaName } from 'mo/common/className';
44
import { IMenuBar } from 'mo/model/workbench/menuBar';
5+
import { Menu } from 'mo/components/menu';
6+
import { DropDown } from 'mo/components/dropdown';
7+
import { Icon } from 'mo/components/icon';
58

69
export interface IMenuBarProps {
710
// menuBar: IMenuBar;
811
}
912

13+
const initialMenuData = [
14+
{
15+
id: 'File',
16+
name: 'File',
17+
data: [
18+
{
19+
id: 'New File',
20+
name: 'New File',
21+
},
22+
{
23+
id: 'OpenFile',
24+
name: 'Open',
25+
},
26+
],
27+
},
28+
{
29+
id: 'Edit',
30+
name: 'Edit',
31+
data: [
32+
{
33+
id: 'Undo',
34+
name: 'Undo',
35+
},
36+
{
37+
id: 'Redo',
38+
name: 'Redo',
39+
},
40+
],
41+
},
42+
{
43+
id: 'Selection',
44+
name: 'Selection',
45+
data: [
46+
{
47+
id: 'SelectAll',
48+
name: 'Select All',
49+
},
50+
{
51+
id: 'CopyLineUp',
52+
name: 'Copy Line Up',
53+
},
54+
],
55+
},
56+
{
57+
id: 'View',
58+
name: 'View',
59+
data: [
60+
{
61+
id: 'Command Palette',
62+
name: 'Command Palette',
63+
},
64+
{
65+
id: 'OpenView',
66+
name: 'Open View',
67+
},
68+
{
69+
id: 'Appearance',
70+
name: 'Appearance',
71+
data: [
72+
{
73+
icon: 'check',
74+
id: 'ShowMenuBar',
75+
name: 'Show Menu Bar',
76+
},
77+
{
78+
icon: 'check',
79+
id: 'ShowSideBar',
80+
name: 'Show Side Bar',
81+
},
82+
{
83+
icon: 'check',
84+
id: 'ShowStatusBar',
85+
name: 'Show Status Bar',
86+
},
87+
{
88+
icon: 'check',
89+
id: 'ShowActivityBar',
90+
name: 'Show Activity Bar',
91+
},
92+
],
93+
},
94+
],
95+
},
96+
{
97+
id: 'Run',
98+
name: 'Run',
99+
data: [
100+
{
101+
id: 'RunTask',
102+
name: 'Run Task',
103+
},
104+
],
105+
},
106+
{
107+
id: 'Help',
108+
name: 'Help',
109+
data: [
110+
{
111+
id: 'About',
112+
name: 'About',
113+
},
114+
],
115+
},
116+
];
117+
10118
function MenuBar(props: IMenuBar) {
11119
const menuBar = props;
12120
const click = function (e) {
13121
menuBar.onClick(e, {
14122
name: 'test',
15123
});
16124
};
125+
const menu = (
126+
<Menu onClick={click} style={{ width: 200 }} data={initialMenuData} />
127+
);
17128
return (
18129
<div className={prefixClaName('menuBar')}>
19-
<a className="menu-action codicon codicon-menu" onClick={click}></a>
130+
<DropDown className="menu-action" placement="right" overlay={menu}>
131+
<Icon type="menu" />
132+
</DropDown>
20133
</div>
21134
);
22135
}

0 commit comments

Comments
 (0)