Skip to content

Commit d251501

Browse files
committed
fix sidebar on mobile && changes chart
1 parent ce4008e commit d251501

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/components/Layout/Layout.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import ChartsMorris from '../../pages/charts/morris';
4949
import ChartsFlot from '../../pages/charts/flot';
5050
import ChartsSparkline from '../../pages/charts/sparkline';
5151
import ChartsRickshaw from '../../pages/charts/rickshaw';
52-
import DashboardAnalytics from '../../pages/analytics';
52+
import DashboardAnalytics from '../../pages/analytics';
5353
import Dashboard from '../../pages/dashboard';
5454

5555
import Header from '../Header';
@@ -83,14 +83,27 @@ class Layout extends React.Component {
8383

8484
componentDidMount() {
8585
const staticSidebar = JSON.parse(localStorage.getItem('staticSidebar'));
86-
if (staticSidebar) {
86+
if (staticSidebar && window.innerWidth > 768) {
8787
this.props.dispatch(toggleSidebar());
8888
} else if (this.props.sidebarOpened) {
8989
setTimeout(() => {
9090
this.props.dispatch(closeSidebar());
9191
this.props.dispatch(changeActiveSidebarItem(null));
9292
}, 2500);
9393
}
94+
95+
this.handleResize();
96+
window.addEventListener('resize', this.handleResize.bind(this));
97+
}
98+
99+
componentWillUnmount() {
100+
window.removeEventListener('resize', this.handleResize.bind(this));
101+
}
102+
103+
handleResize() {
104+
if (window.innerWidth <= 768 && this.props.sidebarStatic) {
105+
this.props.dispatch(toggleSidebar());
106+
}
94107
}
95108

96109
chatToggle() {

src/pages/widgets/components/changes-chart/ChangesChart.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class ChangesChart extends React.Component {
114114
<p className={s.chartValue}><i className="fa fa-caret-up" /> 352.79</p>
115115
<p className={s.chartValueChange}>+2.04 (1.69%)</p>
116116
<div
117+
style={{ overflow: 'hidden' }}
117118
ref={(r) => {
118119
this.rickshawChart = r;
119120
}}

0 commit comments

Comments
 (0)