Add an "Edit Mode" to Dashboard view (#3940)

* Add a togglable edit mode to dashboard

* Submenu for controls

* Allowing 'Save as' outside of editMode

* Set editMode to false as default
This commit is contained in:
Maxime Beauchemin
2017-11-28 09:10:21 -08:00
committed by Grace Guo
parent 6cbe0e6096
commit d9fda346cb
17 changed files with 259 additions and 157 deletions

View File

@@ -1,7 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Modal } from 'react-bootstrap';
import { Modal, MenuItem } from 'react-bootstrap';
import cx from 'classnames';
import Button from './Button';
const propTypes = {
@@ -13,6 +14,7 @@ const propTypes = {
beforeOpen: PropTypes.func,
onExit: PropTypes.func,
isButton: PropTypes.bool,
isMenuItem: PropTypes.bool,
bsSize: PropTypes.string,
className: PropTypes.string,
tooltip: PropTypes.string,
@@ -23,6 +25,7 @@ const defaultProps = {
beforeOpen: () => {},
onExit: () => {},
isButton: false,
isMenuItem: false,
bsSize: null,
className: '',
};
@@ -86,6 +89,13 @@ export default class ModalTrigger extends React.Component {
{this.renderModal()}
</Button>
);
} else if (this.props.isMenuItem) {
return (
<MenuItem onClick={this.open}>
{this.props.triggerNode}
{this.renderModal()}
</MenuItem>
);
}
/* eslint-disable jsx-a11y/interactive-supports-focus */
return (