Files
blitzkit/src/components/Loader.tsx
T

41 lines
887 B
TypeScript
Raw Normal View History

2024-01-05 15:01:45 -06:00
import { blackA } from '@radix-ui/colors';
2024-04-06 12:43:54 -05:00
import { Flex, Spinner, Text } from '@radix-ui/themes';
2024-04-18 19:11:50 -05:00
import { theme } from '../stitches.config';
2024-01-05 15:01:45 -06:00
const NAV_HEIGHT = 52.65;
interface LoaderProps {
naked?: boolean;
2024-01-22 15:50:41 -06:00
progress?: number;
2024-01-05 15:01:45 -06:00
}
2024-04-06 12:43:54 -05:00
export function Loader({ naked, progress }: LoaderProps) {
2024-01-05 15:01:45 -06:00
const animation = (
2024-04-06 12:43:54 -05:00
<Flex align="center" gap="2">
<Spinner />
2024-01-22 15:50:41 -06:00
{progress !== undefined && (
2024-04-06 12:43:54 -05:00
<Text color="gray">{Math.round(progress * 100)}%</Text>
2024-01-22 15:50:41 -06:00
)}
2024-04-06 12:43:54 -05:00
</Flex>
2024-01-05 15:01:45 -06:00
);
if (naked) return animation;
return (
<Flex
style={{
backgroundColor: blackA.blackA10,
position: 'fixed',
top: NAV_HEIGHT,
left: 0,
width: '100%',
height: `calc(100% - ${NAV_HEIGHT}px)`,
padding: theme.spaces.paddingMajor,
}}
align="center"
justify="center"
>
{animation}
</Flex>
);
}