mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Bug fix for collapsing nav
This commit is contained in:
parent
e4cafd4bc3
commit
5423f5dcd7
@ -1,36 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import NotificationStore from '../stores/notification_store';
|
||||
|
||||
import { mergeOptions } from '../utils/general_utils';
|
||||
|
||||
let ContractNotification = React.createClass({
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
NotificationStore.getState()
|
||||
);
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
NotificationStore.listen(this.onChange);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
NotificationStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
null
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default ContractNotification;
|
@ -1,9 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import history from '../history';
|
||||
|
||||
import Nav from 'react-bootstrap/lib/Nav';
|
||||
import Navbar from 'react-bootstrap/lib/Navbar';
|
||||
import CollapsibleNav from 'react-bootstrap/lib/CollapsibleNav';
|
||||
@ -58,11 +59,17 @@ let Header = React.createClass({
|
||||
UserStore.listen(this.onChange);
|
||||
WhitelabelActions.fetchWhitelabel();
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
|
||||
// react-bootstrap 0.25.1 has a bug in which it doesn't
|
||||
// close the mobile expanded navigation after a click by itself.
|
||||
// To get rid of this, we set the state of the component ourselves.
|
||||
history.listen(this.onRouteChange);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
UserStore.unlisten(this.onChange);
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
history.unlisten(this.onRouteChange);
|
||||
},
|
||||
|
||||
getLogo() {
|
||||
@ -135,6 +142,11 @@ let Header = React.createClass({
|
||||
this.refs.dropdownbutton.setDropdownState(false);
|
||||
},
|
||||
|
||||
// On route change, close expanded navbar again
|
||||
onRouteChange() {
|
||||
this.refs.navbar.state.navExpanded = false;
|
||||
},
|
||||
|
||||
render() {
|
||||
let account;
|
||||
let signup;
|
||||
@ -201,8 +213,10 @@ let Header = React.createClass({
|
||||
<Navbar
|
||||
brand={this.getLogo()}
|
||||
toggleNavKey={0}
|
||||
fixedTop={true}>
|
||||
<CollapsibleNav eventKey={0}>
|
||||
fixedTop={true}
|
||||
ref="navbar">
|
||||
<CollapsibleNav
|
||||
eventKey={0}>
|
||||
<Nav navbar left>
|
||||
{this.getPoweredBy()}
|
||||
</Nav>
|
||||
|
Loading…
Reference in New Issue
Block a user