* Add New File and New Folder buttons in Navbar (feature: #758) * Moved the Add File and Add Folder butons from File to Sketch (feature: #758)
This commit is contained in:
parent
661a367b72
commit
9105249c23
1 changed files with 42 additions and 2 deletions
|
@ -1,8 +1,12 @@
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { withRouter } from 'react-router';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import InlineSVG from 'react-inlinesvg';
|
import InlineSVG from 'react-inlinesvg';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import * as IDEActions from '../modules/IDE/actions/ide';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
metaKeyName,
|
metaKeyName,
|
||||||
|
@ -315,6 +319,30 @@ class Nav extends React.PureComponent {
|
||||||
<span>Sketch</span>
|
<span>Sketch</span>
|
||||||
<InlineSVG src={triangleUrl} />
|
<InlineSVG src={triangleUrl} />
|
||||||
</button>
|
</button>
|
||||||
|
<li className="nav__dropdown-item">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
this.props.newFile();
|
||||||
|
this.setDropdown('none');
|
||||||
|
}}
|
||||||
|
onFocus={this.handleFocus.bind(this, 'sketch')}
|
||||||
|
onBlur={this.handleBlur}
|
||||||
|
>
|
||||||
|
Add File
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li className="nav__dropdown-item">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
this.props.newFolder();
|
||||||
|
this.setDropdown('none');
|
||||||
|
}}
|
||||||
|
onFocus={this.handleFocus.bind(this, 'sketch')}
|
||||||
|
onBlur={this.handleBlur}
|
||||||
|
>
|
||||||
|
Add Folder
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
<li className="nav__dropdown-item">
|
<li className="nav__dropdown-item">
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -558,7 +586,9 @@ Nav.propTypes = {
|
||||||
}),
|
}),
|
||||||
startSketch: PropTypes.func.isRequired,
|
startSketch: PropTypes.func.isRequired,
|
||||||
stopSketch: PropTypes.func.isRequired,
|
stopSketch: PropTypes.func.isRequired,
|
||||||
setAllAccessibleOutput: PropTypes.func.isRequired
|
setAllAccessibleOutput: PropTypes.func.isRequired,
|
||||||
|
newFile: PropTypes.func.isRequired,
|
||||||
|
newFolder: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
Nav.defaultProps = {
|
Nav.defaultProps = {
|
||||||
|
@ -569,4 +599,14 @@ Nav.defaultProps = {
|
||||||
cmController: {}
|
cmController: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Nav;
|
function mapDispatchToProps(dispatch) {
|
||||||
|
return bindActionCreators(
|
||||||
|
Object.assign(
|
||||||
|
{},
|
||||||
|
IDEActions
|
||||||
|
),
|
||||||
|
dispatch
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withRouter(connect(() => ({}), mapDispatchToProps)(Nav));
|
||||||
|
|
Loading…
Reference in a new issue