Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
30 lines
701 B
JavaScript
30 lines
701 B
JavaScript
import * as React from 'react';
|
|
import Box from '@mui/material/Box';
|
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
|
|
export default function LinearDeterminate() {
|
|
const [progress, setProgress] = React.useState(0);
|
|
|
|
React.useEffect(() => {
|
|
const timer = setInterval(() => {
|
|
setProgress((oldProgress) => {
|
|
if (oldProgress === 100) {
|
|
return 0;
|
|
}
|
|
const diff = Math.random() * 10;
|
|
return Math.min(oldProgress + diff, 100);
|
|
});
|
|
}, 500);
|
|
|
|
return () => {
|
|
clearInterval(timer);
|
|
};
|
|
}, []);
|
|
|
|
return (
|
|
<Box sx={{ width: '100%' }}>
|
|
<LinearProgress variant="determinate" value={progress} />
|
|
</Box>
|
|
);
|
|
}
|