UNPKG

materialuiupgraded

Version:

Material-UI's workspace package

66 lines (58 loc) 1.47 kB
import React from 'react'; import PropTypes from 'prop-types'; import { MuiThemeProvider, createMuiTheme, withStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import Button from '@material-ui/core/Button'; const styles = { root: { display: 'flex', }, }; const theme = createMuiTheme({ typography: { useNextVariants: true, // Use the system font instead of the default Roboto font. fontFamily: [ '-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif', '"Apple Color Emoji"', '"Segoe UI Emoji"', '"Segoe UI Symbol"', ].join(','), fontWeightMedium: 500, body1: { fontWeight: 500, }, subtitle1: { fontSize: 12, }, button: { fontStyle: 'italic', }, }, }); function TypographyTheme(props) { const { classes } = props; const children = ( <div> <Typography>body1</Typography> <Typography variant="subtitle1">subtitle</Typography> <Button>Button</Button> </div> ); return ( <div className={classes.root}> {children} <MuiThemeProvider theme={theme}>{children}</MuiThemeProvider> </div> ); } TypographyTheme.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(TypographyTheme);