mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +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';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
|
|
||||||
|
import history from '../history';
|
||||||
|
|
||||||
import Nav from 'react-bootstrap/lib/Nav';
|
import Nav from 'react-bootstrap/lib/Nav';
|
||||||
import Navbar from 'react-bootstrap/lib/Navbar';
|
import Navbar from 'react-bootstrap/lib/Navbar';
|
||||||
import CollapsibleNav from 'react-bootstrap/lib/CollapsibleNav';
|
import CollapsibleNav from 'react-bootstrap/lib/CollapsibleNav';
|
||||||
@ -58,11 +59,17 @@ let Header = React.createClass({
|
|||||||
UserStore.listen(this.onChange);
|
UserStore.listen(this.onChange);
|
||||||
WhitelabelActions.fetchWhitelabel();
|
WhitelabelActions.fetchWhitelabel();
|
||||||
WhitelabelStore.listen(this.onChange);
|
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() {
|
componentWillUnmount() {
|
||||||
UserStore.unlisten(this.onChange);
|
UserStore.unlisten(this.onChange);
|
||||||
WhitelabelStore.unlisten(this.onChange);
|
WhitelabelStore.unlisten(this.onChange);
|
||||||
|
history.unlisten(this.onRouteChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLogo() {
|
getLogo() {
|
||||||
@ -135,6 +142,11 @@ let Header = React.createClass({
|
|||||||
this.refs.dropdownbutton.setDropdownState(false);
|
this.refs.dropdownbutton.setDropdownState(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// On route change, close expanded navbar again
|
||||||
|
onRouteChange() {
|
||||||
|
this.refs.navbar.state.navExpanded = false;
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let account;
|
let account;
|
||||||
let signup;
|
let signup;
|
||||||
@ -201,8 +213,10 @@ let Header = React.createClass({
|
|||||||
<Navbar
|
<Navbar
|
||||||
brand={this.getLogo()}
|
brand={this.getLogo()}
|
||||||
toggleNavKey={0}
|
toggleNavKey={0}
|
||||||
fixedTop={true}>
|
fixedTop={true}
|
||||||
<CollapsibleNav eventKey={0}>
|
ref="navbar">
|
||||||
|
<CollapsibleNav
|
||||||
|
eventKey={0}>
|
||||||
<Nav navbar left>
|
<Nav navbar left>
|
||||||
{this.getPoweredBy()}
|
{this.getPoweredBy()}
|
||||||
</Nav>
|
</Nav>
|
||||||
|
Loading…
Reference in New Issue
Block a user