-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,45 @@ | ||
import * as React from 'react'; | ||
import Box from '@material-ui/core/Box'; | ||
import Switch from '@material-ui/core/Switch'; | ||
import Paper from '@material-ui/core/Paper'; | ||
import Zoom from '@material-ui/core/Zoom'; | ||
import FormControlLabel from '@material-ui/core/FormControlLabel'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
height: 180, | ||
}, | ||
container: { | ||
display: 'flex', | ||
}, | ||
paper: { | ||
margin: theme.spacing(1), | ||
}, | ||
svg: { | ||
width: 100, | ||
height: 100, | ||
}, | ||
polygon: { | ||
fill: theme.palette.common.white, | ||
stroke: theme.palette.divider, | ||
strokeWidth: 1, | ||
}, | ||
})); | ||
const icon = ( | ||
<Paper sx={{ m: 1 }} elevation={4}> | ||
<Box component="svg" sx={{ width: 100, height: 100 }}> | ||
<Box | ||
component="polygon" | ||
sx={{ | ||
fill: (theme) => theme.palette.common.white, | ||
stroke: (theme) => theme.palette.divider, | ||
strokeWidth: 1, | ||
}} | ||
points="0,100 50,00, 100,100" | ||
/> | ||
</Box> | ||
</Paper> | ||
); | ||
|
||
export default function SimpleZoom() { | ||
const classes = useStyles(); | ||
const [checked, setChecked] = React.useState(false); | ||
|
||
const handleChange = () => { | ||
setChecked((prev) => !prev); | ||
}; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Box sx={{ height: 180 }}> | ||
<FormControlLabel | ||
control={<Switch checked={checked} onChange={handleChange} />} | ||
label="Show" | ||
/> | ||
<div className={classes.container}> | ||
<Zoom in={checked}> | ||
<Paper elevation={4} className={classes.paper}> | ||
<svg className={classes.svg}> | ||
<polygon points="0,100 50,00, 100,100" className={classes.polygon} /> | ||
</svg> | ||
</Paper> | ||
</Zoom> | ||
<Zoom | ||
in={checked} | ||
style={{ | ||
transitionDelay: checked ? '500ms' : '0ms', | ||
}} | ||
> | ||
<Paper elevation={4} className={classes.paper}> | ||
<svg className={classes.svg}> | ||
<polygon points="0,100 50,00, 100,100" className={classes.polygon} /> | ||
</svg> | ||
</Paper> | ||
<Box sx={{ display: 'flex' }}> | ||
<Zoom in={checked}>{icon}</Zoom> | ||
<Zoom in={checked} style={{ transitionDelay: checked ? '500ms' : '0ms' }}> | ||
{icon} | ||
</Zoom> | ||
</div> | ||
</div> | ||
</Box> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,45 @@ | ||
import * as React from 'react'; | ||
import Box from '@material-ui/core/Box'; | ||
import Switch from '@material-ui/core/Switch'; | ||
import Paper from '@material-ui/core/Paper'; | ||
import Zoom from '@material-ui/core/Zoom'; | ||
import FormControlLabel from '@material-ui/core/FormControlLabel'; | ||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
height: 180, | ||
}, | ||
container: { | ||
display: 'flex', | ||
}, | ||
paper: { | ||
margin: theme.spacing(1), | ||
}, | ||
svg: { | ||
width: 100, | ||
height: 100, | ||
}, | ||
polygon: { | ||
fill: theme.palette.common.white, | ||
stroke: theme.palette.divider, | ||
strokeWidth: 1, | ||
}, | ||
}), | ||
const icon = ( | ||
<Paper sx={{ m: 1 }} elevation={4}> | ||
<Box component="svg" sx={{ width: 100, height: 100 }}> | ||
<Box | ||
component="polygon" | ||
sx={{ | ||
fill: (theme) => theme.palette.common.white, | ||
stroke: (theme) => theme.palette.divider, | ||
strokeWidth: 1, | ||
}} | ||
points="0,100 50,00, 100,100" | ||
/> | ||
</Box> | ||
</Paper> | ||
); | ||
|
||
export default function SimpleZoom() { | ||
const classes = useStyles(); | ||
const [checked, setChecked] = React.useState(false); | ||
|
||
const handleChange = () => { | ||
setChecked((prev) => !prev); | ||
}; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Box sx={{ height: 180 }}> | ||
<FormControlLabel | ||
control={<Switch checked={checked} onChange={handleChange} />} | ||
label="Show" | ||
/> | ||
<div className={classes.container}> | ||
<Zoom in={checked}> | ||
<Paper elevation={4} className={classes.paper}> | ||
<svg className={classes.svg}> | ||
<polygon points="0,100 50,00, 100,100" className={classes.polygon} /> | ||
</svg> | ||
</Paper> | ||
</Zoom> | ||
<Zoom | ||
in={checked} | ||
style={{ | ||
transitionDelay: checked ? '500ms' : '0ms', | ||
}} | ||
> | ||
<Paper elevation={4} className={classes.paper}> | ||
<svg className={classes.svg}> | ||
<polygon points="0,100 50,00, 100,100" className={classes.polygon} /> | ||
</svg> | ||
</Paper> | ||
<Box sx={{ display: 'flex' }}> | ||
<Zoom in={checked}>{icon}</Zoom> | ||
<Zoom in={checked} style={{ transitionDelay: checked ? '500ms' : '0ms' }}> | ||
{icon} | ||
</Zoom> | ||
</div> | ||
</div> | ||
</Box> | ||
</Box> | ||
); | ||
} |