mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-05-12 17:15:52 +00:00
32 lines
764 B
TypeScript
32 lines
764 B
TypeScript
import { memo } from 'react';
|
|
|
|
import { Box, CircularProgress } from '@mui/material';
|
|
import type { SxProps, Theme } from '@mui/material';
|
|
|
|
interface LoadingSpinnerProps {
|
|
height?: number | string;
|
|
}
|
|
|
|
// Extract styles to prevent recreation on every render
|
|
const circularProgressStyles: SxProps<Theme> = (theme: Theme) => ({
|
|
margin: theme.spacing(4),
|
|
color: theme.palette.text.secondary
|
|
});
|
|
|
|
const LoadingSpinner = ({ height = '100%' }: LoadingSpinnerProps) => {
|
|
return (
|
|
<Box
|
|
display="flex"
|
|
alignItems="center"
|
|
justifyContent="center"
|
|
flexDirection="column"
|
|
padding={2}
|
|
height={height}
|
|
>
|
|
<CircularProgress sx={circularProgressStyles} size={100} />
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
export default memo(LoadingSpinner);
|