mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
feat: loading number
This commit is contained in:
1 parent
a32ee2a344
commit
019514b699
3 files changed
+37
-16
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { blackA } from '@radix-ui/colors';
|
||||
import { Flex } from '@radix-ui/themes';
|
||||
import { Flex, Text } from '@radix-ui/themes';
|
||||
import { PuffLoader } from 'react-spinners';
|
||||
import { theme } from '../../../stitches.config';
|
||||
|
||||
@@ -8,11 +8,26 @@ const NAV_HEIGHT = 52.65;
|
||||
interface LoaderProps {
|
||||
naked?: boolean;
|
||||
color?: string;
|
||||
progress?: number;
|
||||
}
|
||||
|
||||
export function Loader({ naked, color }: LoaderProps) {
|
||||
export function Loader({ naked, color, progress }: LoaderProps) {
|
||||
const animation = (
|
||||
<PuffLoader color={color ?? theme.colors.solidBackground} />
|
||||
<div style={{ position: 'relative' }}>
|
||||
{progress !== undefined && (
|
||||
<Text
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: '50%',
|
||||
top: '50%',
|
||||
transform: 'translate(calc(-50% + 4px), calc(-50% + 4px))',
|
||||
}}
|
||||
>
|
||||
{Math.round(progress * 100)}%
|
||||
</Text>
|
||||
)}
|
||||
<PuffLoader color={color ?? theme.colors.solidBackground} />
|
||||
</div>
|
||||
);
|
||||
|
||||
if (naked) return animation;
|
||||
|
||||
Reference in new issue
Block a user