From 5caac197f27ad0e67d12828708c0025cdff88b1d Mon Sep 17 00:00:00 2001 From: Nicole Xie Date: Tue, 2 Jul 2019 10:20:23 -0500 Subject: [PATCH] feat(interiorleftnav): allow default open or collapsed --- src/components/InteriorLeftNav/InteriorLeftNav.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/InteriorLeftNav/InteriorLeftNav.js b/src/components/InteriorLeftNav/InteriorLeftNav.js index f5ad6e7..2d59ce7 100644 --- a/src/components/InteriorLeftNav/InteriorLeftNav.js +++ b/src/components/InteriorLeftNav/InteriorLeftNav.js @@ -12,6 +12,7 @@ export default class InteriorLeftNav extends Component { className: PropTypes.string, activeHref: PropTypes.string, onToggle: PropTypes.func, + open: PropTypes.bool, }; static defaultProps = { @@ -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) => {