Skip to content

Commit

Permalink
SitesDropdown: support onSiteSelect prop.
Browse files Browse the repository at this point in the history
props @ockham.

Avoid redundand getPrimary() call.
  • Loading branch information
mtias committed Dec 14, 2015
1 parent e087e15 commit 888e7f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/components/sites-dropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ export default React.createClass( {
showAllSites: React.PropTypes.bool,
indicator: React.PropTypes.bool,
autoFocus: React.PropTypes.bool,
onClose: React.PropTypes.func
onClose: React.PropTypes.func,
onSiteSelect: React.PropTypes.func
},

getDefaultProps() {
return {
showAllSites: false,
indicator: false,
onClose: noop
onClose: noop,
onSiteSelect: noop
};
},

Expand All @@ -48,10 +50,11 @@ export default React.createClass( {
},

getSelectedSite() {
return sites.getSite( this.state.selected ) || sites.getPrimary();
return sites.getSite( this.state.selected );
},

selectSite( siteSlug ) {
this.props.onSiteSelect( siteSlug );
this.setState( {
selected: siteSlug,
open: false
Expand Down

0 comments on commit 888e7f6

Please sign in to comment.