Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Popover menus with new MenuButton component #580

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions client-app/src/desktop/tabs/forms/InputsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import {restaurants, usStates} from '../../../core/data';
import {wrapper} from '../../common';
import './InputsPanel.scss';
import {InputsPanelModel} from './InputsPanelModel';
import {menu, menuItem, popover} from '@xh/hoist/kit/blueprint';
import {menuItem} from '@xh/hoist/kit/blueprint';
import {menuButton} from '@xh/hoist/desktop/cmp/contextmenu';

export const inputsPanel = hoistCmp.factory({
model: creates(InputsPanelModel),
Expand Down Expand Up @@ -424,12 +425,13 @@ const setFocusMenu = hoistCmp.factory(
menuItems = fields.map(f => {
return menuItem({text: f.displayName, onClick: () => f.focus()});
});
return popover({
target: button({
icon: Icon.target(),
text: 'Set Focus'
}),
content: menu(menuItems)
return menuButton({
icon: Icon.target(),
text: 'Set Focus',
menuItems: menuItems,
popoverProps: {
minimal: false
}
});
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import {hoistCmp, XH} from '@xh/hoist/core/index';
import {button} from '@xh/hoist/desktop/cmp/button';
import {capitalizeWords} from '@xh/hoist/format';
import {Icon} from '@xh/hoist/icon/index';
import {menu, menuItem, popover} from '@xh/hoist/kit/blueprint';
import {menuItem, popover} from '@xh/hoist/kit/blueprint';
import {truncate} from 'lodash';
import {menuButton} from '@xh/hoist/desktop/cmp/contextmenu';

library.add(faGithub, faCodeMerge);

Expand Down Expand Up @@ -104,10 +105,9 @@ function getGitIcon(gitLinks) {
if (gitLinksList.length === 1) {
return button({icon: gitIcon, onClick: () => window.open(gitLinksList[0])});
} else {
return popover({
minimal: true,
target: button({icon: gitIcon}),
content: menu({items: getGitMenuItems(gitLinks)})
return menuButton({
icon: gitIcon,
menuItems: getGitMenuItems(gitLinks)
});
}
}
Expand Down
22 changes: 9 additions & 13 deletions client-app/src/desktop/tabs/panels/BasicPanel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {creates, hoistCmp, XH} from '@xh/hoist/core';
import {div, filler, p} from '@xh/hoist/cmp/layout';
import {menu, menuItem, popover} from '@xh/hoist/kit/blueprint';
import {wrapper} from '../../common/Wrapper';
import {panel} from '@xh/hoist/desktop/cmp/panel';
import {select} from '@xh/hoist/desktop/cmp/input';
Expand All @@ -10,6 +9,7 @@ import {button} from '@xh/hoist/desktop/cmp/button';
import {Icon} from '@xh/hoist/icon';
import {usStates} from '../../../core/data';
import {BasicPanelModel} from './BasicPanelModel';
import {menuButton} from '@xh/hoist/desktop/cmp/contextmenu';

export const basicPanel = hoistCmp.factory({
model: creates(BasicPanelModel),
Expand All @@ -36,18 +36,14 @@ export const basicPanel = hoistCmp.factory({
height: 400,
width: 700,
tbar: [
popover({
position: 'bottom-left',
minimal: true,
target: button({
icon: Icon.chevronDown(),
text: 'Menu Button'
}),
content: menu(
menuItem({text: 'Menu Item'}),
menuItem({text: 'Menu Item 2'}),
menuItem({text: 'Menu Item 3'})
)
menuButton({
icon: Icon.chevronDown(),
text: 'Menu Button',
menuItems: [
{text: 'Menu Item'},
{text: 'Menu Item 2'},
{text: 'Menu Item 3'}
]
})
],
item: div({
Expand Down
18 changes: 8 additions & 10 deletions client-app/src/desktop/tabs/panels/ToolbarPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import {buttonGroupInput, select, switchInput} from '@xh/hoist/desktop/cmp/input
import {panel} from '@xh/hoist/desktop/cmp/panel';
import {toolbar, toolbarSep} from '@xh/hoist/desktop/cmp/toolbar';
import {Icon, xhLogo} from '@xh/hoist/icon';
import {menu, menuItem, popover} from '@xh/hoist/kit/blueprint';
import {menuItem} from '@xh/hoist/kit/blueprint';
import {usStates} from '../../../core/data';
import {wrapper} from '../../common';
import {ToolbarPanelModel} from './ToolbarPanelModel';
import {menuButton} from '@xh/hoist/desktop/cmp/contextmenu';

export const toolbarPanel = hoistCmp.factory({
model: creates(ToolbarPanelModel),
Expand Down Expand Up @@ -57,18 +58,15 @@ const topBar = hoistCmp.factory(
text: 'Edit',
intent: 'primary'
}),
popover({
position: 'bottom-left',
minimal: true,
target: button({
icon: Icon.chevronDown(),
text: 'Menu Button'
}),
content: menu(
menuButton({
icon: Icon.chevronDown(),
text: 'Menu Button',
menuItems: [
menuItem({text: 'Menu Item'}),
menuItem({text: 'Menu Item 2'}),
menuItem({text: 'Menu Item 3'})
)
]

}),
filler(),
switchInput({
Expand Down