diff options
Diffstat (limited to 'frontend/app/views/page/components/page.header.js')
| -rw-r--r-- | frontend/app/views/page/components/page.header.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/frontend/app/views/page/components/page.header.js b/frontend/app/views/page/components/page.header.js new file mode 100644 index 0000000..eb1c3b9 --- /dev/null +++ b/frontend/app/views/page/components/page.header.js @@ -0,0 +1,36 @@ +import React from 'react' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' +import { Link } from 'react-router-dom' + +import * as graphActions from '../../graph/graph.actions' +import * as pageActions from '../page.actions' + +function PageHeader(props) { + return ( + <header> + <div> + <Link to={props.graph.show.res ? "/" + props.graph.show.res.path : "/"} className="logo"><b>{props.site.siteTitle}</b></Link> + </div> + <div> + <button onClick={() => props.pageActions.toggleAddTileForm()}>+ Add tile</button> + <button onClick={() => props.pageActions.toggleTileList()}>Sort tiles</button> + <button onClick={() => props.graphActions.toggleEditPageForm()}>Edit page</button> + </div> + </header> + ) +} + +const mapStateToProps = (state) => ({ + // auth: state.auth, + site: state.site, + graph: state.graph, + // isAuthenticated: state.auth.isAuthenticated, +}) + +const mapDispatchToProps = (dispatch) => ({ + graphActions: bindActionCreators({ ...graphActions }, dispatch), + pageActions: bindActionCreators({ ...pageActions }, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(PageHeader) |
