second commit :S
This commit is contained in:
@@ -4,7 +4,10 @@ import { connect } from 'react-redux';
|
||||
import 'normalize.css/normalize.css';
|
||||
import styles from './App.scss';
|
||||
|
||||
import { toggleEditors } from '../../Actions';
|
||||
import {
|
||||
toggleEditors,
|
||||
toggleHistorySidebar,
|
||||
} from '../../Actions';
|
||||
|
||||
import Header from '../../Components/Header';
|
||||
|
||||
@@ -13,17 +16,18 @@ import Auth from '../../Utils/Auth';
|
||||
class App extends Component {
|
||||
static propTypes = {
|
||||
children: React.PropTypes.element,
|
||||
activeEditors: React.PropTypes.isRequired,
|
||||
activeEditors: React.PropTypes.array.isRequired,
|
||||
toggleEditors: React.PropTypes.func.isRequired,
|
||||
showHistorySidebar: React.PropTypes.bool.isRequired,
|
||||
toggleHistorySidebar: React.PropTypes.func.isRequired,
|
||||
}
|
||||
|
||||
static defaultProps = {}
|
||||
|
||||
state = {
|
||||
loggedIn: Auth.loggedIn(),
|
||||
}
|
||||
|
||||
componentWillMount = () => {
|
||||
console.log(this.props);
|
||||
Auth.onChange = this.updateAuth;
|
||||
}
|
||||
|
||||
@@ -44,6 +48,8 @@ class App extends Component {
|
||||
<Header
|
||||
activeEditors={this.props.activeEditors}
|
||||
toggleEditors={this.props.toggleEditors}
|
||||
showHistorySidebar={this.props.showHistorySidebar}
|
||||
toggleHistorySidebar={this.props.toggleHistorySidebar}
|
||||
/>
|
||||
<div className={ styles.content }>
|
||||
{ this.props.children }
|
||||
@@ -56,6 +62,7 @@ class App extends Component {
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
activeEditors: state.activeEditors,
|
||||
showHistorySidebar: state.historySidebar.visible,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -64,6 +71,9 @@ const mapDispatchToProps = (dispatch) => {
|
||||
toggleEditors: (toggledEditor) => {
|
||||
dispatch(toggleEditors(toggledEditor));
|
||||
},
|
||||
toggleHistorySidebar: () => {
|
||||
dispatch(toggleHistorySidebar());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
|
||||
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor';
|
||||
import TextEditor from '../../Components/TextEditor';
|
||||
import HistorySidebar from '../../Components/HistorySidebar';
|
||||
|
||||
import { toMarkdown } from '../../Utils/Markdown';
|
||||
import { updateText } from '../../Actions';
|
||||
@@ -14,7 +15,8 @@ class Dashboard extends Component {
|
||||
editMarkdown: React.PropTypes.func.isRequired,
|
||||
editText: React.PropTypes.func.isRequired,
|
||||
text: React.PropTypes.string,
|
||||
activeEditors: React.PropTypes.array,
|
||||
activeEditors: React.PropTypes.arrayOf(React.PropTypes.string),
|
||||
showHistorySidebar: React.PropTypes.bool.isRequired,
|
||||
}
|
||||
|
||||
// componentDidMount = () => {
|
||||
@@ -25,6 +27,7 @@ class Dashboard extends Component {
|
||||
// }
|
||||
|
||||
render() {
|
||||
console.log(this.props.showHistorySidebar);
|
||||
const activeEditors = this.props.activeEditors;
|
||||
|
||||
return (
|
||||
@@ -47,6 +50,13 @@ class Dashboard extends Component {
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
{
|
||||
this.props.showHistorySidebar ?
|
||||
<div className={styles.sidebar}>
|
||||
<HistorySidebar />
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -57,6 +67,7 @@ const mapStateToProps = (state) => {
|
||||
text: state.text,
|
||||
editor: state.editor,
|
||||
activeEditors: state.activeEditors,
|
||||
showHistorySidebar: state.historySidebar.visible,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user