add pressure
This commit is contained in:
51
src/App.js
51
src/App.js
@@ -2,14 +2,15 @@ import React, {Component} from 'react';
|
||||
import {Flow} from './Flows';
|
||||
import {Title} from './Title';
|
||||
import {Sidebar} from './Sidebar';
|
||||
import {PressureHelper} from './PressureHelper';
|
||||
import {TokenCtx} from './UserAction';
|
||||
|
||||
class App extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
sidebar_title: null,
|
||||
sidebar_content: null,
|
||||
sidebar_title: '',
|
||||
sidebar_content: null, // determine status of sidebar
|
||||
mode: 'list', // list, single, search, attention
|
||||
search_text: null,
|
||||
flow_render_key: +new Date(),
|
||||
@@ -17,6 +18,17 @@ class App extends Component {
|
||||
};
|
||||
this.show_sidebar_bound=this.show_sidebar.bind(this);
|
||||
this.set_mode_bound=this.set_mode.bind(this);
|
||||
this.on_pressure_bound=this.on_pressure.bind(this);
|
||||
}
|
||||
|
||||
on_pressure() {
|
||||
if(this.state.sidebar_content)
|
||||
this.setState({
|
||||
sidebar_title: '',
|
||||
sidebar_content: null,
|
||||
});
|
||||
else
|
||||
this.set_mode('list',null);
|
||||
}
|
||||
|
||||
show_sidebar(title,content) {
|
||||
@@ -45,25 +57,24 @@ class App extends Component {
|
||||
});
|
||||
},
|
||||
}}>
|
||||
<div>
|
||||
<div className="bg-img" style={{
|
||||
backgroundImage: 'url('+(localStorage['REPLACE_ERIRI_WITH_URL'] || 'static/eriri_bg.jpg')+')'
|
||||
}} />
|
||||
<Title show_sidebar={this.show_sidebar_bound} set_mode={this.set_mode_bound} />
|
||||
<div className="left-container">
|
||||
<TokenCtx.Consumer>{(token)=>(
|
||||
<Flow key={this.state.flow_render_key} show_sidebar={this.show_sidebar_bound}
|
||||
mode={this.state.mode} search_text={this.state.search_text} token={token.value}
|
||||
/>
|
||||
)}</TokenCtx.Consumer>
|
||||
<br />
|
||||
</div>
|
||||
<Sidebar do_close={()=>{
|
||||
this.setState({
|
||||
sidebar_content: null,
|
||||
});
|
||||
}} content={this.state.sidebar_content} title={this.state.sidebar_title} />
|
||||
<PressureHelper callback={this.on_pressure_bound} />
|
||||
<div className="bg-img" style={{
|
||||
backgroundImage: 'url('+(localStorage['REPLACE_ERIRI_WITH_URL'] || 'static/eriri_bg.jpg')+')'
|
||||
}} />
|
||||
<Title show_sidebar={this.show_sidebar_bound} set_mode={this.set_mode_bound} />
|
||||
<div className="left-container">
|
||||
<TokenCtx.Consumer>{(token)=>(
|
||||
<Flow key={this.state.flow_render_key} show_sidebar={this.show_sidebar_bound}
|
||||
mode={this.state.mode} search_text={this.state.search_text} token={token.value}
|
||||
/>
|
||||
)}</TokenCtx.Consumer>
|
||||
<br />
|
||||
</div>
|
||||
<Sidebar do_close={()=>{
|
||||
this.setState({
|
||||
sidebar_content: null,
|
||||
});
|
||||
}} content={this.state.sidebar_content} title={this.state.sidebar_title} />
|
||||
</TokenCtx.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user