-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDAN-519] Toggle map display in Agenda Preview
style changes style changes style change - 2 open map by default if no coverages changed to component update
- Loading branch information
Showing
6 changed files
with
143 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
class BannerDrop extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { open: this.props.isOpen }; | ||
this.toggleOpen = this.toggleOpen.bind(this); | ||
} | ||
|
||
componentWillReceiveProps(nextProps) { | ||
if (this.state.open !== nextProps.isOpen) { | ||
this.setState({ open: nextProps.isOpen }); | ||
} | ||
} | ||
|
||
toggleOpen() { | ||
this.setState({ open: !this.state.open}); | ||
} | ||
|
||
render() { | ||
return (<div className="banner-drop"> | ||
<div className={classNames('banner-drop__child', | ||
{'banner-drop__child--active': this.state.open})}> | ||
{this.props.children} | ||
</div> | ||
{this.props.label && <div className={classNames('banner-drop__text', 'pl-5', 'ml-5', | ||
{'banner-drop__text--active': this.state.open})}>{this.props.label}</div>} | ||
<div className="banner-drop__toggle"> | ||
<div className="banner-drop__line banner-drop__line--left" /> | ||
<button type="button" className={classNames({'active': this.state.open})}> | ||
<i className="banner-drop__toggle icon-small--arrow-down" onClick={this.toggleOpen} /> | ||
</button> | ||
<div className="banner-drop__line banner-drop__line--right" /> | ||
</div> | ||
</div>); | ||
} | ||
} | ||
|
||
BannerDrop.propTypes = { | ||
children: PropTypes.node, | ||
label: PropTypes.string, | ||
isOpen: PropTypes.bool, | ||
}; | ||
|
||
export default BannerDrop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters