mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 02:57:30 +00:00
Keep context menu open when clicking
This commit is contained in:
parent
f730ee26aa
commit
e27a0db3fe
3 changed files with 18 additions and 5 deletions
|
|
@ -47,9 +47,9 @@ export class ContextMenu extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { selected, top, bottom, children } = this.props;
|
||||
const { selected, top, bottom, children, openMenu } = this.props;
|
||||
return (
|
||||
<div className={classnames({ selected, top, bottom })}>
|
||||
<div className={classnames({ selected, top, bottom })} onClick={openMenu}>
|
||||
<ul id="context-menu">
|
||||
{children}
|
||||
</ul>
|
||||
|
|
@ -60,6 +60,7 @@ export class ContextMenu extends React.Component {
|
|||
|
||||
ContextMenu.propTypes = {
|
||||
closeMenu: React.PropTypes.func.isRequired,
|
||||
openMenu: React.PropTypes.func.isRequired,
|
||||
children: React.PropTypes.any.isRequired,
|
||||
top: React.PropTypes.bool,
|
||||
bottom: React.PropTypes.bool
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { CLOSE_CONTEXT_MENU } from "../actionTypes";
|
||||
import { CLOSE_CONTEXT_MENU, TOGGLE_CONTEXT_MENU } from "../actionTypes";
|
||||
import { close, setSkinFromFilename, openFileDialog } from "../actionCreators";
|
||||
import { ContextMenu, Hr, Node, Parent, LinkNode } from "./ContextMenu";
|
||||
|
||||
|
|
@ -14,7 +14,12 @@ const SKINS = [
|
|||
];
|
||||
|
||||
const MainContextMenu = props =>
|
||||
<ContextMenu closeMenu={props.closeMenu} selected={props.selected} bottom>
|
||||
<ContextMenu
|
||||
closeMenu={props.closeMenu}
|
||||
openMenu={props.openMenu}
|
||||
selected={props.selected}
|
||||
bottom
|
||||
>
|
||||
<LinkNode
|
||||
href="https://github.com/captbaritone/winamp2-js"
|
||||
target="_blank"
|
||||
|
|
@ -42,8 +47,14 @@ const mapDispatchToProps = (dispatch, ownProps) => ({
|
|||
closeMenu: () => {
|
||||
dispatch({ type: CLOSE_CONTEXT_MENU });
|
||||
},
|
||||
openMenu: () => {
|
||||
dispatch({ type: TOGGLE_CONTEXT_MENU });
|
||||
},
|
||||
openFileDialog: () => dispatch(openFileDialog(ownProps.fileInput)),
|
||||
setSkin: filename => dispatch(setSkinFromFilename(filename))
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps)(MainContextMenu);
|
||||
export default connect(
|
||||
state => ({ selected: state.contextMenu.selected }),
|
||||
mapDispatchToProps
|
||||
)(MainContextMenu);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ exports[`MainWindow renders to snapshot 1`] = `
|
|||
>
|
||||
<div
|
||||
className="bottom"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<ul
|
||||
id="context-menu"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue