Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

GifsMenuButton.tsx 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch, useSelector } from 'react-redux';
  4. import ReactionButton from '../../../reactions/components/web/ReactionButton';
  5. import { IReactionsMenuParent } from '../../../reactions/types';
  6. import { setGifMenuVisibility } from '../../actions';
  7. import { isGifsMenuOpen } from '../../functions.web';
  8. interface IProps {
  9. parent: IReactionsMenuParent;
  10. }
  11. const GifsMenuButton = ({ parent }: IProps) => {
  12. const menuOpen = useSelector(isGifsMenuOpen);
  13. const { t } = useTranslation();
  14. const dispatch = useDispatch();
  15. const icon = (
  16. <img
  17. alt = 'GIPHY Logo'
  18. height = { parent === IReactionsMenuParent.OverflowMenu ? 16 : 24 }
  19. src = 'images/GIPHY_icon.png' />
  20. );
  21. const handleClick = useCallback(() => {
  22. dispatch(setGifMenuVisibility(!menuOpen));
  23. }, [ menuOpen, parent ]);
  24. return (
  25. <ReactionButton
  26. accessibilityLabel = { t('toolbar.accessibilityLabel.giphy') }
  27. icon = { icon }
  28. key = 'gif'
  29. onClick = { handleClick }
  30. toggled = { true }
  31. tooltip = { t('toolbar.accessibilityLabel.giphy') } />
  32. );
  33. };
  34. export default GifsMenuButton;