Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fullscreen button #17966

Closed
yordis opened this issue Oct 20, 2019 · 1 comment
Closed

Add fullscreen button #17966

yordis opened this issue Oct 20, 2019 · 1 comment

Comments

@yordis
Copy link
Contributor

yordis commented Oct 20, 2019

I am not sure how to start the conversation around

Offer an option to the highly used and well-maintained components to move to the official organization: > mui-org/x on GitHub, @material-ui/x on npm and x.material-ui.com for the documentation.

Using Fullscreen and FullscreenExit combined with Fullscreen API is a common component to have in some back-office driven apps.

Actual code, copied from https://www.npmjs.com/package/@straw-hat/react-fullscreen (I am the author, feel free to send feedbacks, https://bundlephobia.com/result?p=@straw-hat/[email protected])

import * as React from 'react';
import IconButton from '@material-ui/core/IconButton';
import FullscreenIcon from '@material-ui/icons/Fullscreen';
import FullscreenExitIcon from '@material-ui/icons/FullscreenExit';

import { useFullscreen } from '@straw-hat/react-fullscreen';
 
export const FullscreenButton: React.FC<{ target: HTMLElement | null }> = (props) => {
  const { isFullscreen, toggleFullscreen } = useFullscreen(props.target);
 
  return (
    <IconButton color="inherit" onClick={toggleFullscreen}>
      {isFullscreen ? <FullscreenExitIcon /> : <FullscreenIcon />}
    </IconButton>
  );
};

Cheers,

@oliviertassinari
Copy link
Member

oliviertassinari commented Oct 20, 2019

@yordis Thanks for sharing and for #16880. It's great to have a minimum support level of full screen, even if it's not a frequent feature people ask for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants