import React from "react"; import { Box, CircularProgress, Typography, Grid, LinearProgress, Fade, } from "@mui/material"; import { styled } from "@mui/material/styles"; // Types for props interface LoadingComponentProps { /** Text to display while loading */ loadingText?: string; /** Type of loader to show */ loaderType?: "circular" | "linear"; /** Whether to show with fade-in animation */ withFade?: boolean; /** Duration of fade-in animation in ms */ fadeDuration?: number; } // Styled components const LoadingContainer = styled(Box)(({ theme }) => ({ width: "100%", padding: theme.spacing(3), display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", })); /** * A loading component to display at the top of pages while content is loading */ const LoadingComponent: React.FC = ({ loadingText = "Loading content...", loaderType = "circular", withFade = true, fadeDuration = 800, }) => { const content = ( {loaderType === "circular" ? ( ) : ( )} {loadingText} ); // Return with or without fade animation return withFade ? ( {content} ) : ( content ); }; export { LoadingComponent };