summaryrefslogtreecommitdiff
path: root/frontend/views/page/components/page.header.js
blob: 3eff339809e50990e29c838c9ec61c700af3faa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'

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.showAddTileForm()}>+ Add tile</button>
      </div>
    </header>
  )
}

const mapStateToProps = (state) => ({
  // auth: state.auth,
  site: state.site,
  graph: state.graph,
  // isAuthenticated: state.auth.isAuthenticated,
})

const mapDispatchToProps = (dispatch) => ({
  pageActions: bindActionCreators({ ...pageActions }, dispatch),
})

export default connect(mapStateToProps, mapDispatchToProps)(PageHeader)