This commit is contained in:
giancarlo
2024-03-24 02:23:22 +08:00
parent 648d77b430
commit bce3479368
589 changed files with 37067 additions and 9596 deletions

View File

@@ -0,0 +1,38 @@
'use client';
import { createRef, useEffect, useRef } from 'react';
import type { LoadingBarRef } from 'react-top-loading-bar';
import LoadingBar from 'react-top-loading-bar';
export function TopLoadingBarIndicator() {
const ref = createRef<LoadingBarRef>();
const runningRef = useRef(false);
useEffect(() => {
if (!ref.current || runningRef.current) {
return;
}
const loadingBarRef = ref.current;
loadingBarRef.continuousStart(0, 250);
runningRef.current = true;
return () => {
loadingBarRef.complete();
runningRef.current = false;
};
}, [ref]);
return (
<LoadingBar
height={4}
waitingTime={0}
shadow
className={'bg-primary'}
color={''}
ref={ref}
/>
);
}