@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
24 lines (23 loc) • 1.22 kB
JavaScript
import * as React from 'react';
import Dialog from '../../../components/Dialog';
import { Box } from 'rebass';
export function AdaptableLoadingScreen(props) {
const { showLoadingScreen, loadingScreenDelay, loadingScreenTitle, loadingScreenText } = props;
const [delayElapsed, setDelayElapsed] = React.useState(typeof loadingScreenDelay === 'number' ? false : showLoadingScreen);
React.useEffect(() => {
if (typeof loadingScreenDelay === 'number') {
const timeoutId = setTimeout(() => {
setDelayElapsed(true);
}, loadingScreenDelay);
return () => {
clearTimeout(timeoutId);
};
}
}, [loadingScreenDelay]);
return (React.createElement(Dialog, { modal: true, isOpen: delayElapsed ? showLoadingScreen : false, onDismiss: props.onClose, showCloseButton: false, className: "ab-LoadingScreen", style: {
minHeight: 'auto',
} },
React.createElement(Box, { padding: 3 },
React.createElement("h4", null, loadingScreenTitle ?? 'Initialising Grid'),
React.createElement("p", null, loadingScreenText ?? 'Retrieving your settings and setting up the grid...'))));
}