@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
20 lines (19 loc) • 1.22 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import Dialog from '../../../components/Dialog';
import { Box } from '../../../components/Flex';
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 (_jsx(Dialog, { modal: true, isOpen: delayElapsed ? showLoadingScreen : false, onDismiss: props.onClose, showCloseButton: false, className: "ab-LoadingScreen twa:min-h-auto", children: _jsxs(Box, { className: "twa:p-3", children: [_jsx("h4", { children: loadingScreenTitle ?? 'Initialising Grid' }), _jsx("p", { children: loadingScreenText ?? 'Retrieving your settings and setting up the grid...' })] }) }));
}