File size: 1,153 Bytes
3299552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import React from 'react';
import { CircularProgress, Box, Typography, Fade } from '@mui/material';
import { styled } from '@mui/material/styles';

// Fix the styled component to use proper spacing
const StyledBox = styled(Box)(({ theme }) => ({
  display: 'flex',
  flexDirection: 'column',
  alignItems: 'center',
  justifyContent: 'center',
  padding: theme.spacing ? theme.spacing(2) : '16px', // Provide fallback
  textAlign: 'center',
}));

const LoadingSpinner = ({ message = 'Loading...', size = 40 }) => {
  return (
    <Fade in={true} timeout={600}>
      <StyledBox>
        <CircularProgress
          size={size}
          thickness={4}
          sx={{
            color: (theme) => theme.palette.primary.main,
            marginBottom: (theme) => theme.spacing?.(2) || '16px',
          }}
        />
        {message && (
          <Typography
            variant="body1"
            sx={{
              fontWeight: 500,
              color: (theme) => theme.palette.text.secondary,
            }}
          >
            {message}
          </Typography>
        )}
      </StyledBox>
    </Fade>
  );
};

export default LoadingSpinner;