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
22 lines
640 B
TypeScript
22 lines
640 B
TypeScript
import * as React from 'react';
|
|
import Tooltip from '@mui/material/Tooltip';
|
|
import IconButton from '@mui/material/IconButton';
|
|
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
|
|
|
|
export default function LoadingIconButton() {
|
|
const [loading, setLoading] = React.useState(false);
|
|
React.useEffect(() => {
|
|
const timeout = setTimeout(() => {
|
|
setLoading(false);
|
|
}, 2000);
|
|
return () => clearTimeout(timeout);
|
|
});
|
|
return (
|
|
<Tooltip title="Click to see loading">
|
|
<IconButton onClick={() => setLoading(true)} loading={loading}>
|
|
<ShoppingCartIcon />
|
|
</IconButton>
|
|
</Tooltip>
|
|
);
|
|
}
|