The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
1.0 KiB

  1. import { openDropdownMenu, closeDropdownMenu } from '../actions/dropdown_menu';
  2. import { openModal, closeModal } from '../actions/modal';
  3. import { connect } from 'react-redux';
  4. import DropdownMenu from '../components/dropdown_menu';
  5. import { isUserTouching } from '../is_mobile';
  6. const mapStateToProps = state => ({
  7. isModalOpen: state.get('modal').modalType === 'ACTIONS',
  8. dropdownPlacement: state.getIn(['dropdown_menu', 'placement']),
  9. openDropdownId: state.getIn(['dropdown_menu', 'openId']),
  10. openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
  11. });
  12. const mapDispatchToProps = (dispatch, { status, items }) => ({
  13. onOpen(id, onItemClick, dropdownPlacement, keyboard) {
  14. dispatch(isUserTouching() ? openModal('ACTIONS', {
  15. status,
  16. actions: items,
  17. onClick: onItemClick,
  18. }) : openDropdownMenu(id, dropdownPlacement, keyboard));
  19. },
  20. onClose(id) {
  21. dispatch(closeModal());
  22. dispatch(closeDropdownMenu(id));
  23. },
  24. });
  25. export default connect(mapStateToProps, mapDispatchToProps)(DropdownMenu);