Skip to content

Commit

Permalink
Make dropdown open overflowing content below.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Dec 10, 2015
1 parent db79348 commit 7ad7e49
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
38 changes: 20 additions & 18 deletions client/components/sites-dropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,27 @@ export default React.createClass( {
render() {
return (
<div className={ classNames( 'sites-dropdown', { 'is-open': this.state.open } ) }>
<div
className="sites-dropdown__selected"
onClick={ () => this.setState( { open: ! this.state.open } ) }
>
<Site
site={ this.getSelectedSite() }
/>
<Gridicon icon={ this.state.open ? 'chevron-up' : 'chevron-down' } />
<div className="sites-dropdown__wrapper">
<div
className="sites-dropdown__selected"
onClick={ () => this.setState( { open: ! this.state.open } ) }
>
<Site
site={ this.getSelectedSite() }
/>
<Gridicon icon={ this.state.open ? 'chevron-up' : 'chevron-down' } />
</div>
{ this.state.open &&
<SiteSelector
sites={ sites }
autoFocus={ true }
onClose={ this.props.onClose }
onSiteSelect={ this.selectSite }
selected={ this.state.selected }
hideSelected={ true }
/>
}
</div>
{ this.state.open &&
<SiteSelector
sites={ sites }
autoFocus={ true }
onClose={ this.props.onClose }
onSiteSelect={ this.selectSite }
selected={ this.state.selected }
hideSelected={ true }
/>
}
</div>
);
}
Expand Down
24 changes: 17 additions & 7 deletions client/components/sites-dropdown/style.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
.sites-dropdown {
background: $white;
border: 1px solid lighten( $gray, 20% );
border-width: 1px 1px 2px;
border-radius: 4px;
margin: 24px 0;
position: relative;
width: 300px;
&.is-open {
height: 69px;
}

.gridicons-chevron-down,
.gridicons-chevron-up {
Expand All @@ -16,6 +12,20 @@
}
}

.sites-dropdown__wrapper {
background: $white;
border: 1px solid lighten( $gray, 20% );
border-width: 1px 1px 2px;
border-radius: 4px;
margin: 0;
position: relative;
width: 300px;
}

.sites-dropdown.is-open .sites-dropdown__wrapper {
margin: 0;
}

.sites-dropdown__selected {
cursor: pointer;

Expand Down

0 comments on commit 7ad7e49

Please sign in to comment.