forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFnLoader.tsx
50 lines (45 loc) · 1.38 KB
/
FnLoader.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { Box, CircularProgress, CircularProgressProps, Typography, type BoxProps } from '@mui/material';
import React, { type ReactNode, type FC, type HTMLAttributes } from 'react';
import { useTheme2 } from '@grafana/ui';
import logoUrl from './fn-logo.svg';
export type FnLoaderProps = {
outerContainerProps?: Omit<BoxProps, 'children'>;
innerContainerProps?: Omit<BoxProps, 'children'>;
circularProgressProps?: CircularProgressProps;
imageProps?: HTMLAttributes<HTMLImageElement>;
text?: ReactNode;
};
export const FnLoader: FC<FnLoaderProps> = ({
outerContainerProps,
innerContainerProps,
circularProgressProps,
imageProps,
text,
}) => {
const theme = useTheme2();
return (
<Box
display="flex"
justifyContent="center"
alignItems="center"
flexDirection="column"
paddingTop="150px"
{...outerContainerProps}
>
<img src={logoUrl} alt={'FluxNinja logo'} style={{ transform: 'scale(4)' }} {...imageProps} />
<Box marginTop="100px" {...innerContainerProps}>
<CircularProgress
role="alert"
aria-busy="true"
aria-label="Loading..."
disableShrink
sx={{
color: theme.colors.primary.main,
}}
{...circularProgressProps}
/>
</Box>
{typeof text === 'string' ? <Typography>{text}</Typography> : text || null}
</Box>
);
};