Header.jsx 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import React from 'react'
  2. import { connect } from 'react-redux'
  3. import i18n from '../i18n.js'
  4. import Logo from '../component/Header/Logo.jsx'
  5. import NavbarToggler from '../component/Header/NavbarToggler.jsx'
  6. import MenuLinkList from '../component/Header/MenuLinkList.jsx'
  7. // import MenuActionList from '../component/Header/MenuActionList.jsx'
  8. import MenuActionListItemSearch from '../component/Header/MenuActionListItem/Search.jsx'
  9. import MenuActionListItemDropdownLang from '../component/Header/MenuActionListItem/DropdownLang.jsx'
  10. import MenuActionListItemHelp from '../component/Header/MenuActionListItem/Help.jsx'
  11. import MenuActionListItemMenuProfil from '../component/Header/MenuActionListItem/MenuProfil.jsx'
  12. import logoHeader from '../img/logoHeader.svg'
  13. import { setLangActive } from '../action-creator.sync.js'
  14. class Header extends React.Component {
  15. handleClickLogo = () => {}
  16. handleClickFeature = () => {}
  17. handleClickExplore = () => {}
  18. handleClickAbout = () => {}
  19. handleChangeInput = e => this.setState({inputSearchValue: e.target.value})
  20. handleClickSubmit = () => {}
  21. handleChangeLang = langId => {
  22. this.props.dispatch(setLangActive(langId))
  23. i18n.changeLanguage(langId)
  24. }
  25. handleClickHelp = () => {}
  26. handleClickLogout = () => {}
  27. render () {
  28. const { lang, user } = this.props
  29. return (
  30. <header className='header'>
  31. <nav className='navbar navbar-expand-md navbar-light bg-light'>
  32. <Logo logoSrc={logoHeader} onClickImg={this.handleClickLogo} />
  33. <div className='header__breadcrumb d-none d-lg-block ml-4'>
  34. Ressource humaine - liste des contenus
  35. </div>
  36. <NavbarToggler />
  37. <div className='header__menu collapse navbar-collapse justify-content-end' id='navbarSupportedContent'>
  38. <MenuLinkList
  39. onClickFeature={this.handleClickFeature}
  40. onClickExplore={this.handleClickExplore}
  41. onClickAbout={this.handleClickAbout}
  42. />
  43. <ul className='header__menu__rightside'>
  44. <MenuActionListItemSearch
  45. onChangeInput={this.handleChangeInput}
  46. onClickSubmit={this.handleClickSubmit}
  47. />
  48. <MenuActionListItemDropdownLang
  49. langList={lang}
  50. onChangeLang={this.handleChangeLang}
  51. />
  52. <MenuActionListItemHelp
  53. onClickHelp={this.handleClickHelp}
  54. />
  55. <MenuActionListItemMenuProfil
  56. user={user}
  57. onClickLogout={this.handleClickLogout}
  58. />
  59. </ul>
  60. </div>
  61. </nav>
  62. </header>
  63. )
  64. }
  65. }
  66. const mapStateToProps = ({ lang, user }) => ({ lang, user })
  67. export default connect(mapStateToProps)(Header)