31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import React, { useContext } from 'react';
|
|
import FullscreenButtonComponent from './component';
|
|
import FullscreenService from './service';
|
|
import { NLayoutContext } from '../layout/context/context';
|
|
|
|
const FullscreenButtonContainer = props => <FullscreenButtonComponent {...props} />;
|
|
|
|
export default (props) => {
|
|
const handleToggleFullScreen = ref => FullscreenService.toggleFullScreen(ref);
|
|
const isIphone = (navigator.userAgent.match(/iPhone/i)) ? true : false;
|
|
|
|
const newLayoutContext = useContext(NLayoutContext);
|
|
const { newLayoutContextState, newLayoutContextDispatch } = newLayoutContext;
|
|
const { layoutLoaded: layoutManagerLoaded } = newLayoutContextState;
|
|
const { input } = newLayoutContextState;
|
|
const { fullscreen } = input;
|
|
const { element } = fullscreen;
|
|
const isFullscreen = layoutManagerLoaded === 'new' ? !!element : props.isFullscreen;
|
|
|
|
return (
|
|
<FullscreenButtonContainer {...props} {...{
|
|
handleToggleFullScreen,
|
|
isIphone,
|
|
layoutManagerLoaded,
|
|
isFullscreen,
|
|
element,
|
|
newLayoutContextDispatch
|
|
}} />
|
|
);
|
|
};
|