SelectStatus.jsx 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react'
  2. import { translate } from 'react-i18next'
  3. import i18n from '../../../i18n.js'
  4. require('./SelectStatus.styl')
  5. export const SelectStatus = props => {
  6. translate.setI18n(props.i18n ? props.i18n : i18n) // mandatory to allow Apps to overrides trad
  7. return (
  8. <div className='selectStatus dropdown'>
  9. <button
  10. className='selectStatus__dropdownbtn check btn dropdown-toggle'
  11. type='button'
  12. id='dropdownMenu2'
  13. data-toggle='dropdown'
  14. aria-haspopup='true'
  15. aria-expanded='false'
  16. style={{color: props.selectedStatus ? props.selectedStatus.hexcolor : 'transparent'}}
  17. disabled={props.disabled}
  18. >
  19. <span className='selectStatus__dropdownbtn__label'>Status :</span>
  20. {props.selectedStatus ? props.selectedStatus.label : ''}
  21. <div className='selectStatus__dropdownbtn__icon'>
  22. <i className={`fa fa-${props.selectedStatus ? props.selectedStatus.faIcon : ''}`} />
  23. </div>
  24. </button>
  25. <div className='selectStatus__submenu dropdown-menu' aria-labelledby='dropdownMenu2'>
  26. <h6 className='dropdown-header'>{props.t('Input.SelectStatus.file_status')}</h6>
  27. <div className='dropdown-divider' />
  28. {props.availableStatus.map(s =>
  29. <button
  30. className='selectStatus__submenu__item current dropdown-item'
  31. type='button'
  32. onClick={() => props.onChangeStatus(s.slug)}
  33. key={`status_${s.slug}`}
  34. style={{color: s.hexcolor}}
  35. >
  36. {s.label /* props.t('Input.SelectStatus.ongoing') */}
  37. <div className='selectStatus__submenu__item__icon'>
  38. <i className={`fa fa-fw fa-${s.faIcon}`} />
  39. </div>
  40. </button>
  41. )}
  42. </div>
  43. </div>
  44. )
  45. }
  46. export default translate()(SelectStatus)