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.

ToggleTopPanelLabel.tsx 1.1KB

12345678910111213141516171819202122232425262728293031
  1. /* eslint-disable lines-around-comment */
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useDispatch, useSelector } from 'react-redux';
  5. import { IReduxState } from '../../../app/types';
  6. import { IconMenuDown } from '../../../base/icons/svg/index';
  7. import Label from '../../../base/label/components/web/Label';
  8. // @ts-ignore
  9. import { Tooltip } from '../../../base/tooltip';
  10. // @ts-ignore
  11. import { setTopPanelVisible } from '../../../filmstrip/actions.web';
  12. const ToggleTopPanelLabel = () => {
  13. const dispatch = useDispatch();
  14. const { t } = useTranslation();
  15. const topPanelHidden = !useSelector((state: IReduxState) => state['features/filmstrip'].topPanelVisible);
  16. const onClick = useCallback(() => {
  17. dispatch(setTopPanelVisible(true));
  18. }, []);
  19. return topPanelHidden && (<Tooltip
  20. content = { t('toggleTopPanelLabel') }
  21. position = { 'bottom' }>
  22. <Label
  23. icon = { IconMenuDown }
  24. onClick = { onClick } />
  25. </Tooltip>);
  26. };
  27. export default ToggleTopPanelLabel;