Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

Commit

Permalink
feat(interiorleftnav): allow default open or collapsed (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoxxie authored and zeusorion committed Jul 24, 2019
1 parent 8db33d1 commit f9311fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/InteriorLeftNav/InteriorLeftNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default class InteriorLeftNav extends Component {
className: PropTypes.string,
activeHref: PropTypes.string,
onToggle: PropTypes.func,
open: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -21,13 +22,16 @@ export default class InteriorLeftNav extends Component {
state = {
activeHref:
this.props.activeHref || (window.location && window.location.pathname),
open: true,
open: typeof this.props.open !== 'undefined' ? this.props.open : true,
};

componentWillReceiveProps = nextProps => {
if (nextProps.activeHref) {
this.setState({ activeHref: nextProps.activeHref });
}
if (typeof nextProps.open != 'undefined') {
this.setState({ open: nextProps.open });
}
};

handleItemClick = (evt, href) => {
Expand Down

0 comments on commit f9311fe

Please sign in to comment.