Skip to content

Commit

Permalink
Merge pull request jquense#54 from jrm2k6/master
Browse files Browse the repository at this point in the history
Do not show view toolbar if only one view is specified
  • Loading branch information
jquense committed Mar 3, 2016
2 parents 196d9e7 + f1d120c commit e60e47d
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ let Toolbar = React.createClass({

<span className='rbc-btn-group'>
{
viewNames.map(name =>
<button type='button' key={name}
className={cn({'rbc-active': view === name})}
onClick={this.view.bind(null, name)}
>
{messages[name]}
</button>
)
this.viewNamesGroup(messages)
}
</span>
</div>
Expand All @@ -61,6 +54,25 @@ let Toolbar = React.createClass({

view(view){
this.props.onViewChange(view)
},

viewNamesGroup(messages) {
let component = null
let viewNames = this.props.views
const view = this.props.view

if (viewNames.length > 1) {
return (
viewNames.map(name =>
<button type='button' key={name}
className={cn({'rbc-active': view === name})}
onClick={this.view.bind(null, name)}
>
{messages[name]}
</button>
)
)
}
}
});

Expand Down

0 comments on commit e60e47d

Please sign in to comment.