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
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import * as React from 'react';
|
|
import Box from '@mui/material/Box';
|
|
import Switch from '@mui/material/Switch';
|
|
import Paper from '@mui/material/Paper';
|
|
import Grow from '@mui/material/Grow';
|
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
|
|
const icon = (
|
|
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
|
|
<svg width="100" height="100">
|
|
<Box
|
|
component="polygon"
|
|
points="0,100 50,00, 100,100"
|
|
sx={(theme) => ({
|
|
fill: theme.palette.common.white,
|
|
stroke: theme.palette.divider,
|
|
strokeWidth: 1,
|
|
})}
|
|
/>
|
|
</svg>
|
|
</Paper>
|
|
);
|
|
|
|
export default function SimpleGrow() {
|
|
const [checked, setChecked] = React.useState(false);
|
|
|
|
const handleChange = () => {
|
|
setChecked((prev) => !prev);
|
|
};
|
|
|
|
return (
|
|
<Box sx={{ height: 180 }}>
|
|
<FormControlLabel
|
|
control={<Switch checked={checked} onChange={handleChange} />}
|
|
label="Show"
|
|
/>
|
|
<Box sx={{ display: 'flex' }}>
|
|
<Grow in={checked}>{icon}</Grow>
|
|
{/* Conditionally applies the timeout prop to change the entry speed. */}
|
|
<Grow
|
|
in={checked}
|
|
style={{ transformOrigin: '0 0 0' }}
|
|
{...(checked ? { timeout: 1000 } : {})}
|
|
>
|
|
{icon}
|
|
</Grow>
|
|
</Box>
|
|
</Box>
|
|
);
|
|
}
|