MenuProfil.jsx 1.3KB

123456789101112131415161718192021222324252627282930313233
  1. import React from 'react'
  2. import { Link } from 'react-router-dom'
  3. import PropTypes from 'prop-types'
  4. import { PAGE } from '../../../helper.js'
  5. const MenuProfil = props => {
  6. return props.user.logged
  7. ? (
  8. <li className='header__menu__rightside__itemprofil'>
  9. <div className='profilgroup dropdown'>
  10. <button className='profilgroup__name btn btn-secondary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
  11. <img className='profilgroup__name__imgprofil' src={props.user.avatar} alt='avatar' />
  12. <div className='profilgroup__name__text'>
  13. {props.user.name}
  14. </div>
  15. </button>
  16. <div className='profilgroup__setting dropdown-menu' aria-labelledby='dropdownMenuButton'>
  17. <Link className='setting__link dropdown-item' to={PAGE.ACCOUNT}>Mon compte</Link>
  18. {/* <div className='setting__link dropdown-item'>Mot de passe</div> */}
  19. <div className='setting__link dropdown-item' onClick={props.onClickLogout}>Se déconnecter</div>
  20. </div>
  21. </div>
  22. </li>
  23. )
  24. : ''
  25. }
  26. export default MenuProfil
  27. MenuProfil.propTypes = {
  28. user: PropTypes.object.isRequired,
  29. onClickLogout: PropTypes.func.isRequired
  30. }