Skip to content

Commit

Permalink
implement file:new #119
Browse files Browse the repository at this point in the history
resets all code files and sets mode back to html
  • Loading branch information
gabrielflorit committed Nov 28, 2014
1 parent 49447ae commit e6b7b1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
18 changes: 16 additions & 2 deletions src/js/Livecoding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,26 @@ var Livecoding = React.createClass({

// Handle menu item click.
handleMenuItemClick: function(topic, menuItem) {
console.log(menuItem);

switch(menuItem) {
case 'file:new':

// Reset all three code files
// and set mode back to html.
this.setState({
html: '',
javascript: '',
css: '',
mode: 'html'
});

break;
}
}

});

// Render the entire application to `#main`.
// Render the entire application to `.main`.
React.render(
<Livecoding />,
document.querySelector('.main')
Expand Down
31 changes: 4 additions & 27 deletions src/js/Menubar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ var MenuBar = React.createClass({
<li className={this.state.selectedMenu === 'file' ? 'current' : ''}>
<button className='menubutton' onMouseEnter={this.handleMenuMouseEnter} onClick={this.handleMenuClick}>file</button>
<ul className={'menu' + (this.state.selectedMenu === 'file' ? ' selected' : '')}>
<li className={this.state.selectedMenu === 'file' && this.state.selectedItem === 'save' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>save</button></li>
<li className={this.state.selectedMenu === 'file' && this.state.selectedItem === 'new' ? 'current' : ''}>
<button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>new</button>
</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -153,29 +155,4 @@ var MenuBar = React.createClass({

});

module.exports = MenuBar;

// <li className={this.state.selectedMenu === 'file' ? 'current' : ''}>
// <button className='menubutton' onMouseEnter={this.handleMenuMouseEnter} onClick={this.handleMenuClick}>file</button>
// <ul className={'menu' + (this.state.selectedMenu === 'file' ? ' selected' : '')}>
// <li className={this.state.selectedMenu === 'file' && this.state.selectedItem === 'new file' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>new file</button></li>
// <li className={this.state.selectedMenu === 'file' && this.state.selectedItem === 'open...' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>open...</button></li>
// <li className={this.state.selectedMenu === 'file' && this.state.selectedItem === 'open recent' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>open recent</button></li>
// </ul>
// </li>
// <li className={this.state.selectedMenu === 'edit' ? 'current' : ''}>
// <button className='menubutton' onMouseEnter={this.handleMenuMouseEnter} onClick={this.handleMenuClick}>edit</button>
// <ul className={'menu' + (this.state.selectedMenu === 'edit' ? ' selected' : '')}>
// <li className={this.state.selectedMenu === 'edit' && this.state.selectedItem === 'undo' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>undo</button></li>
// <li className={this.state.selectedMenu === 'edit' && this.state.selectedItem === 'repeat' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>repeat</button></li>
// <li className={this.state.selectedMenu === 'edit' && this.state.selectedItem === 'more' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>more</button></li>
// </ul>
// </li>
// <li className={this.state.selectedMenu === 'selection' ? 'current' : ''}>
// <button className='menubutton' onMouseEnter={this.handleMenuMouseEnter} onClick={this.handleMenuClick}>selection</button>
// <ul className={'menu' + (this.state.selectedMenu === 'selection' ? ' selected' : '')}>
// <li className={this.state.selectedMenu === 'selection' && this.state.selectedItem === 'split' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>split</button></li>
// <li className={this.state.selectedMenu === 'selection' && this.state.selectedItem === 'add' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>add</button></li>
// <li className={this.state.selectedMenu === 'selection' && this.state.selectedItem === 'single' ? 'current' : ''}><button onClick={this.handleItemClick} className='menubutton' onMouseEnter={this.handleItemMouseEnter}>single</button></li>
// </ul>
// </li>
module.exports = MenuBar;

0 comments on commit e6b7b1c

Please sign in to comment.