Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 34x 34x 34x 34x 292x 274x | import {
IconButton as MuiIconButton,
IconButtonProps as MuiIconButtonProps,
styled,
useTheme,
} from "@mui/material";
import { forwardRef } from "react";
import CircularProgress from "./CircularProgress";
const StyledCircularProgress = styled(CircularProgress)(({ theme }) => ({
margin: 3,
}));
interface IconButtonProps extends MuiIconButtonProps {
"aria-label": string;
loading?: boolean;
}
export default forwardRef(function IconButton(
{ loading, ...otherProps }: IconButtonProps,
ref: IconButtonProps["ref"],
) {
const theme = useTheme();
return (
<MuiIconButton {...otherProps} ref={ref}>
{loading ? (
<StyledCircularProgress size={theme.typography.pxToRem(18)} />
) : (
otherProps.children
)}
</MuiIconButton>
);
});
|