-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Migrate batch of demos to hooks/typescript (#16003)
* [docs] Migrate components/typography/TypographyTheme * [docs] Migrate components/transitions * [docs] Migrate components/links * Migrate some demos in customization/components * use immediate export * Move Polygon out of function * use immediate exports
- Loading branch information
Showing
22 changed files
with
667 additions
and
264 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
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* eslint-disable jsx-a11y/anchor-is-valid */ | ||
|
||
import React from 'react'; | ||
import Link from '@material-ui/core/Link'; | ||
|
||
export default function ButtonLink() { | ||
return ( | ||
<Link | ||
component="button" | ||
variant="body2" | ||
onClick={() => { | ||
alert("I'm a button."); | ||
}} | ||
> | ||
Button Link | ||
</Link> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-disable no-script-url */ | ||
import React from 'react'; | ||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; | ||
import Link from '@material-ui/core/Link'; | ||
import Typography from '@material-ui/core/Typography'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
link: { | ||
margin: theme.spacing(1), | ||
}, | ||
}), | ||
); | ||
|
||
// This resolves to nothing and doesn't affect browser history | ||
const dudUrl = 'javascript:;'; | ||
|
||
export default function Links() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Typography> | ||
<Link href={dudUrl} className={classes.link}> | ||
Link | ||
</Link> | ||
<Link href={dudUrl} color="inherit" className={classes.link}> | ||
{'color="inherit"'} | ||
</Link> | ||
<Link href={dudUrl} variant="body2" className={classes.link}> | ||
{'variant="body2"'} | ||
</Link> | ||
</Typography> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react'; | ||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; | ||
import Switch from '@material-ui/core/Switch'; | ||
import Paper from '@material-ui/core/Paper'; | ||
import Collapse from '@material-ui/core/Collapse'; | ||
import FormControlLabel from '@material-ui/core/FormControlLabel'; | ||
|
||
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, | ||
}, | ||
}), | ||
); | ||
|
||
export default function SimpleCollapse() { | ||
const classes = useStyles(); | ||
const [checked, setChecked] = React.useState(false); | ||
|
||
function handleChange() { | ||
setChecked(prev => !prev); | ||
} | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<FormControlLabel | ||
control={<Switch checked={checked} onChange={handleChange} />} | ||
label="Show" | ||
/> | ||
<div className={classes.container}> | ||
<Collapse 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> | ||
</Collapse> | ||
<Collapse in={checked} collapsedHeight="40px"> | ||
<Paper elevation={4} className={classes.paper}> | ||
<svg className={classes.svg}> | ||
<polygon points="0,100 50,00, 100,100" className={classes.polygon} /> | ||
</svg> | ||
</Paper> | ||
</Collapse> | ||
</div> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.