2024-06-07 20:17:03 +03:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
import { ThreeCircles, ThreeDots } from 'react-loader-spinner';
|
|
|
|
|
2024-06-26 19:47:05 +03:00
|
|
|
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
|
|
|
import AnimateFade from '../wrap/AnimateFade';
|
|
|
|
|
|
|
|
interface LoaderProps {
|
2024-11-21 15:09:31 +03:00
|
|
|
/** Scale of the loader from 1 to 10. */
|
|
|
|
scale?: number;
|
|
|
|
|
|
|
|
/** Show a circular loader. */
|
2024-06-07 20:17:03 +03:00
|
|
|
circular?: boolean;
|
|
|
|
}
|
|
|
|
|
2024-11-21 15:09:31 +03:00
|
|
|
/**
|
|
|
|
* Displays animated loader.
|
|
|
|
*/
|
|
|
|
function Loader({ scale = 5, circular }: LoaderProps) {
|
2024-06-07 20:17:03 +03:00
|
|
|
const { colors } = useConceptOptions();
|
|
|
|
return (
|
|
|
|
<AnimateFade noFadeIn className='flex justify-center'>
|
|
|
|
{circular ? (
|
2024-11-21 15:09:31 +03:00
|
|
|
<ThreeCircles color={colors.bgPrimary} height={scale * 20} width={scale * 20} />
|
2024-06-07 20:17:03 +03:00
|
|
|
) : (
|
2024-11-21 15:09:31 +03:00
|
|
|
<ThreeDots color={colors.bgPrimary} height={scale * 20} width={scale * 20} radius={scale * 2} />
|
2024-06-07 20:17:03 +03:00
|
|
|
)}
|
|
|
|
</AnimateFade>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Loader;
|