Нема описа

123456789101112131415161718192021222324252627282930313233343536373839
  1. import './style.scss'
  2. import React from 'react'
  3. import { getHeadings } from 'configs/maps'
  4. import DropDown from 'components/common/DropDown'
  5. export default (props) => {
  6. const headings = getHeadings(props.language)
  7. const currentHeadingIndex = headings.findIndex((item) => item.command === props.current)
  8. const caption = headings[currentHeadingIndex] ? headings[currentHeadingIndex].title : props.language.controls.normal
  9. return (
  10. <DropDown
  11. caption={caption}
  12. containerNode={props.containerNode}
  13. title={props.language.controls.headings}
  14. arrowActive={currentHeadingIndex === 0}
  15. className={'control-item dropdown headings-dropdown'}
  16. >
  17. <ul className='menu'>
  18. {
  19. headings.map((item, index) => {
  20. let isActive = props.current === item.command
  21. return (
  22. <li
  23. key={index}
  24. className={'menu-item' + (isActive ? ' active' : '')}
  25. onClick={() => props.onChange(item.command, item.type)}
  26. >
  27. {item.text}
  28. </li>
  29. )
  30. })
  31. }
  32. </ul>
  33. </DropDown>
  34. )
  35. }