2023-12-13 14:32:57 +03:00
|
|
|
'use client';
|
|
|
|
|
2024-04-27 15:19:20 +03:00
|
|
|
import { ThreeCircles, ThreeDots } from 'react-loader-spinner';
|
2023-07-15 17:46:19 +03:00
|
|
|
|
2024-06-26 19:47:31 +03:00
|
|
|
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
2023-09-03 18:26:50 +03:00
|
|
|
|
2024-01-04 19:30:10 +03:00
|
|
|
interface LoaderProps {
|
2024-11-21 15:09:51 +03:00
|
|
|
/** Scale of the loader from 1 to 10. */
|
|
|
|
scale?: number;
|
|
|
|
|
|
|
|
/** Show a circular loader. */
|
2024-04-27 15:19:20 +03:00
|
|
|
circular?: boolean;
|
2023-08-13 13:18:50 +03:00
|
|
|
}
|
|
|
|
|
2024-11-21 15:09:51 +03:00
|
|
|
/**
|
|
|
|
* Displays animated loader.
|
|
|
|
*/
|
|
|
|
function Loader({ scale = 5, circular }: LoaderProps) {
|
2024-04-01 19:07:20 +03:00
|
|
|
const { colors } = useConceptOptions();
|
2024-12-12 13:19:12 +03:00
|
|
|
if (circular) {
|
|
|
|
return (
|
|
|
|
<ThreeCircles
|
|
|
|
color={colors.bgPrimary}
|
|
|
|
height={scale * 20}
|
|
|
|
width={scale * 20}
|
|
|
|
wrapperClass='flex justify-center'
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<ThreeDots
|
|
|
|
color={colors.bgPrimary}
|
|
|
|
height={scale * 20}
|
|
|
|
width={scale * 20}
|
|
|
|
radius={scale * 2}
|
|
|
|
wrapperClass='flex justify-center'
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2023-12-28 14:04:44 +03:00
|
|
|
}
|
2024-01-07 03:29:16 +03:00
|
|
|
|
|
|
|
export default Loader;
|