Skip to content
Snippets Groups Projects
Commit 4d171320 authored by danieldeng2's avatar danieldeng2
Browse files

Change sidebar behaviour

parent a907f569
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,8 @@ type AppState = { ...@@ -22,7 +22,8 @@ type AppState = {
class App extends React.Component<{}, AppState> { class App extends React.Component<{}, AppState> {
width = window.innerWidth; width = window.innerWidth;
isSideBarSet = false; isTimelineView = false;
constructor(props: {}) { constructor(props: {}) {
super(props); super(props);
this.state = { this.state = {
...@@ -53,10 +54,7 @@ class App extends React.Component<{}, AppState> { ...@@ -53,10 +54,7 @@ class App extends React.Component<{}, AppState> {
this.showOrHideSideBars(); this.showOrHideSideBars();
} }
}); });
if (!this.isSideBarSet) { this.showOrHideSideBars();
console.log("showOrHideSideBars");
this.showOrHideSideBars();
}
} }
setDarkTheme(toSet: boolean) { setDarkTheme(toSet: boolean) {
...@@ -89,7 +87,7 @@ class App extends React.Component<{}, AppState> { ...@@ -89,7 +87,7 @@ class App extends React.Component<{}, AppState> {
} }
showOrHideSideBars() { showOrHideSideBars() {
if (window.innerWidth <= 1024) { if (window.innerWidth <= 1024 || this.isTimelineView) {
this.setState({ this.setState({
toggledLeft: false, toggledLeft: false,
toggledRight: false, toggledRight: false,
...@@ -149,13 +147,11 @@ class App extends React.Component<{}, AppState> { ...@@ -149,13 +147,11 @@ class App extends React.Component<{}, AppState> {
toggledLeft={this.state.toggledLeft} toggledLeft={this.state.toggledLeft}
toggledRight={this.state.toggledRight} toggledRight={this.state.toggledRight}
initTimelineSideBar={() => { initTimelineSideBar={() => {
this.setState({ this.isTimelineView = true;
toggledLeft: false, this.showOrHideSideBars();
toggledRight: false,
});
this.isSideBarSet = true;
}} }}
revertTimelineSideBar={() => { revertTimelineSideBar={() => {
this.isTimelineView = false;
this.showOrHideSideBars(); this.showOrHideSideBars();
}} }}
onOverlayClick={(e) => { onOverlayClick={(e) => {
......
...@@ -9,7 +9,6 @@ class Timeline extends React.Component<TimelineProps, {}> { ...@@ -9,7 +9,6 @@ class Timeline extends React.Component<TimelineProps, {}> {
componentDidMount() {; componentDidMount() {;
this.props.initSideBar(); this.props.initSideBar();
console.log("mounted");
} }
componentWillUnmount() { componentWillUnmount() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment