1
1
import PropTypes from 'prop-types' ;
2
2
import React from 'react' ;
3
+ import { bindActionCreators } from 'redux' ;
4
+ import { connect } from 'react-redux' ;
5
+ import { withRouter } from 'react-router' ;
3
6
import { Link } from 'react-router' ;
4
7
import InlineSVG from 'react-inlinesvg' ;
5
8
import classNames from 'classnames' ;
9
+ import * as IDEActions from '../modules/IDE/actions/ide' ;
6
10
7
11
import {
8
12
metaKeyName ,
@@ -315,6 +319,30 @@ class Nav extends React.PureComponent {
315
319
< span > Sketch</ span >
316
320
< InlineSVG src = { triangleUrl } />
317
321
</ button >
322
+ < li className = "nav__dropdown-item" >
323
+ < button
324
+ onClick = { ( ) => {
325
+ this . props . newFile ( ) ;
326
+ this . setDropdown ( 'none' ) ;
327
+ } }
328
+ onFocus = { this . handleFocus . bind ( this , 'sketch' ) }
329
+ onBlur = { this . handleBlur }
330
+ >
331
+ Add File
332
+ </ button >
333
+ </ li >
334
+ < li className = "nav__dropdown-item" >
335
+ < button
336
+ onClick = { ( ) => {
337
+ this . props . newFolder ( ) ;
338
+ this . setDropdown ( 'none' ) ;
339
+ } }
340
+ onFocus = { this . handleFocus . bind ( this , 'sketch' ) }
341
+ onBlur = { this . handleBlur }
342
+ >
343
+ Add Folder
344
+ </ button >
345
+ </ li >
318
346
< li className = "nav__dropdown-item" >
319
347
< button
320
348
onClick = { ( ) => {
@@ -558,7 +586,9 @@ Nav.propTypes = {
558
586
} ) ,
559
587
startSketch : PropTypes . func . isRequired ,
560
588
stopSketch : PropTypes . func . isRequired ,
561
- setAllAccessibleOutput : PropTypes . func . isRequired
589
+ setAllAccessibleOutput : PropTypes . func . isRequired ,
590
+ newFile : PropTypes . func . isRequired ,
591
+ newFolder : PropTypes . func . isRequired
562
592
} ;
563
593
564
594
Nav . defaultProps = {
@@ -569,4 +599,14 @@ Nav.defaultProps = {
569
599
cmController : { }
570
600
} ;
571
601
572
- export default Nav ;
602
+ function mapDispatchToProps ( dispatch ) {
603
+ return bindActionCreators (
604
+ Object . assign (
605
+ { } ,
606
+ IDEActions
607
+ ) ,
608
+ dispatch
609
+ ) ;
610
+ }
611
+
612
+ export default withRouter ( connect ( ( ) => ( { } ) , mapDispatchToProps ) ( Nav ) ) ;
0 commit comments