您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

FullscreenButton.ts 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { connect } from 'react-redux';
  2. import { IReduxState } from '../../../app/types';
  3. import { translate } from '../../../base/i18n/functions';
  4. import { IconEnterFullscreen, IconExitFullscreen } from '../../../base/icons/svg';
  5. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  6. interface IProps extends AbstractButtonProps {
  7. /**
  8. * Whether or not the app is currently in full screen.
  9. */
  10. _fullScreen?: boolean;
  11. }
  12. /**
  13. * Implementation of a button for toggling fullscreen state.
  14. */
  15. class FullscreenButton extends AbstractButton<IProps> {
  16. accessibilityLabel = 'toolbar.accessibilityLabel.enterFullScreen';
  17. toggledAccessibilityLabel = 'toolbar.accessibilityLabel.exitFullScreen';
  18. label = 'toolbar.enterFullScreen';
  19. toggledLabel = 'toolbar.exitFullScreen';
  20. tooltip = 'toolbar.enterFullScreen';
  21. toggledTooltip = 'toolbar.exitFullScreen';
  22. toggledIcon = IconExitFullscreen;
  23. icon = IconEnterFullscreen;
  24. /**
  25. * Indicates whether this button is in toggled state or not.
  26. *
  27. * @override
  28. * @protected
  29. * @returns {boolean}
  30. */
  31. _isToggled() {
  32. return this.props._fullScreen;
  33. }
  34. }
  35. /**
  36. * Function that maps parts of Redux state tree into component props.
  37. *
  38. * @param {Object} state - Redux state.
  39. * @returns {Object}
  40. */
  41. const mapStateToProps = (state: IReduxState) => {
  42. return {
  43. _fullScreen: state['features/toolbox'].fullScreen
  44. };
  45. };
  46. export default translate(connect(mapStateToProps)(FullscreenButton));