Remove top navbar's auto-hide
This commit is contained in:
parent
a9347a9d27
commit
54d7fbdc5a
1 changed files with 0 additions and 45 deletions
|
@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { Link, NavLink, withRouter } from 'react-router-dom';
|
import { Link, NavLink, withRouter } from 'react-router-dom';
|
||||||
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
||||||
import { throttle } from 'lodash';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import NotificationsCounterIcon from './notifications_counter_icon';
|
import NotificationsCounterIcon from './notifications_counter_icon';
|
||||||
|
@ -43,33 +42,10 @@ class TabsBar extends React.PureComponent {
|
||||||
router: PropTypes.object,
|
router: PropTypes.object,
|
||||||
}
|
}
|
||||||
|
|
||||||
lastScrollTop = 0;
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.window = window;
|
|
||||||
this.documentElement = document.scrollingElement || document.documentElement;
|
|
||||||
|
|
||||||
this.attachScrollListener();
|
|
||||||
// Handle initial scroll posiiton
|
|
||||||
this.handleScroll();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.detachScrollListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
setRef = ref => {
|
setRef = ref => {
|
||||||
this.node = ref;
|
this.node = ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
attachScrollListener() {
|
|
||||||
this.window.addEventListener('scroll', this.handleScroll);
|
|
||||||
}
|
|
||||||
|
|
||||||
detachScrollListener() {
|
|
||||||
this.window.removeEventListener('scroll', this.handleScroll);
|
|
||||||
}
|
|
||||||
|
|
||||||
getNavLinks() {
|
getNavLinks() {
|
||||||
const { intl: { formatMessage }, logo, account } = this.props;
|
const { intl: { formatMessage }, logo, account } = this.props;
|
||||||
let links = [];
|
let links = [];
|
||||||
|
@ -117,27 +93,6 @@ class TabsBar extends React.PureComponent {
|
||||||
this.props.toggleTheme(this.getNewThemeValue());
|
this.props.toggleTheme(this.getNewThemeValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
handleScroll = throttle(() => {
|
|
||||||
if (this.window) {
|
|
||||||
const { pageYOffset, innerWidth } = this.window;
|
|
||||||
if (innerWidth > 895) return;
|
|
||||||
const { scrollTop } = this.documentElement;
|
|
||||||
|
|
||||||
let st = pageYOffset || scrollTop;
|
|
||||||
if (st > this.lastScrollTop){
|
|
||||||
let offset = st - this.lastScrollTop;
|
|
||||||
if (offset > 50) this.setState({ collapsed: true });
|
|
||||||
} else {
|
|
||||||
let offset = this.lastScrollTop - st;
|
|
||||||
if (offset > 50) this.setState({ collapsed: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
this.lastScrollTop = st <= 0 ? 0 : st;
|
|
||||||
}
|
|
||||||
}, 150, {
|
|
||||||
trailing: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { account, onOpenCompose, onOpenSidebar, intl, themeMode } = this.props;
|
const { account, onOpenCompose, onOpenSidebar, intl, themeMode } = this.props;
|
||||||
const { collapsed } = this.state;
|
const { collapsed } = this.state;
|
||||||
|
|
Loading…
Reference in a new issue