Я использую createMuiTheme
, чтобы настроить мою тему с помощью Material UI. Как установить определенный шрифт для тегов заголовка, тела и кнопки?
Я предполагаю, что это будет настройка компонента оформления в теме. А затем выбрав его из компонента приложения. Но не могу найти никаких документов, касающихся этого.
Файл темы:
import { createMuiTheme } from "@material-ui/core/styles";
export default createMuiTheme({
typography: {
fontFamily: ["campton-book", "campton-light", "campton-medium"].join(",")
//something here setting specific font family for specific tags?
}
});
import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles, MuiThemeProvider } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import Theme from "../Theme";
const styles = theme => ({
root: {
flexGrow: 1
}
});
class Tools extends Component {
render() {
const { classes } = this.props;
return (
<MuiThemeProvider theme={Theme}>
<Typography variant="h2">Some text here as h2 and the "campton-light" font family</Typography>
<Typography variant="body1">Some text here as body1 and the "campton-book" font family</Typography>
<Typography variant="overline">Some text here as overline and the "campton-medium" font family</Typography>
</MuiThemeProvider>
);
}
}
Apps.propTypes = {
classes: PropTypes.object.isRequired
};
export default withStyles(styles)(Apps);