import React, { FC, PropsWithChildren } from 'react' import Loading from './loading' import { LayoutRoot } from '../layout_root' import { Flex } from '../flex' import EVENT_TYPE from '../../event_type' import { LoadingFullScreenProps, LoadingFullScreenStatic } from './types' const LoadingFullScreen: FC & LoadingFullScreenStatic = ({ text, size = '40px', }) => { return ( {text && {text}} ) } LoadingFullScreen.render = function ( props: PropsWithChildren ): void { window.dispatchEvent(new window.CustomEvent(EVENT_TYPE.FULL_LOADING_SHOW)) LayoutRoot.setComponent(LayoutRoot.Type.FULL_LOADING, ) const documentBody = window.document.body if (documentBody) { documentBody.classList.add('gm-loading-body-overflow') } } LoadingFullScreen.hide = function () { window.dispatchEvent(new window.CustomEvent(EVENT_TYPE.FULL_LOADING_HIDE)) LayoutRoot.removeComponent(LayoutRoot.Type.FULL_LOADING) const documentBody = window.document.body if (documentBody) { documentBody.classList.remove('gm-loading-body-overflow') } } export default LoadingFullScreen