import React from "react"; import Card from "@mui/material/Card"; import { Typography } from "@mui/material"; import Box from '@mui/material/Box'; import CircularProgress from '@mui/material/CircularProgress'; import { green } from '@mui/material/colors'; import Button from '@mui/material/Button'; import Fab from '@mui/material/Fab'; import CheckIcon from '@mui/icons-material/Check'; import SaveIcon from '@mui/icons-material/Save'; export default function InteractiveIntegration() { const [loading, setLoading] = React.useState(false); const [success, setSuccess] = React.useState(false); const timer = React.useRef(); const buttonSx = { ...(success && { bgcolor: green[500], '&:hover': { bgcolor: green[700], }, }), }; React.useEffect(() => { return () => { clearTimeout(timer.current); }; }, []); const handleButtonClick = () => { if (!loading) { setSuccess(false); setLoading(true); timer.current = window.setTimeout(() => { setSuccess(true); setLoading(false); }, 2000); } }; return ( <> Interactive Integration {success ? : } {loading && ( )} {loading && ( )} ); }