import {Box, CircularProgress} from "@mui/material";

export default function LoadingTemplate({loading, marginLeft, children, className}) {
    return (
        <Box className={`w-full ` + className} sx={{ position: 'relative' }}>
            {children}
            {loading && (
                <CircularProgress
                    size={24}
                    sx={{
                        color: "#fff",
                        position: 'absolute',
                        top: '50%',
                        left: '50%',
                        marginTop: '-12px',
                        marginLeft: marginLeft,
                    }}
                />
            )}
        </Box>
    )
}