mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
27 lines
721 B
TypeScript
27 lines
721 B
TypeScript
import { useNavigation } from 'react-router';
|
|
import { useDebounce } from 'use-debounce';
|
|
|
|
import { Loader } from '@/components/Loader';
|
|
import { ModalBackdrop } from '@/components/Modal/ModalBackdrop';
|
|
import { PARAMETER } from '@/utils/constants';
|
|
|
|
export function GlobalLoader() {
|
|
const navigation = useNavigation();
|
|
|
|
const isLoading = navigation.state === 'loading';
|
|
const [loadingDebounced] = useDebounce(isLoading, PARAMETER.navigationPopupDelay);
|
|
|
|
if (!loadingDebounced) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className='cc-modal-wrapper'>
|
|
<ModalBackdrop />
|
|
<div className='z-pop cc-fade-in px-10 border rounded-xl bg-prim-100'>
|
|
<Loader scale={6} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|