Skip to content

Commit 0f7978c

Browse files
refactor: Use next/font to optimize web fonts (#209)
1 parent 5f8b4d4 commit 0f7978c

File tree

4 files changed

+8
-47
lines changed

4 files changed

+8
-47
lines changed

.storybook/preview-head.html

-8
This file was deleted.

src/pages/_document.tsx

-22
This file was deleted.

src/styles/globals.css

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ html,
22
body {
33
padding: 0;
44
margin: 0;
5-
font-family: 'Poppins', 'Montserrat', -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
6-
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
75
}
86

97
a {

src/styles/theme.ts

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { createTheme, ThemeOptions } from '@mui/material/styles'
22
import { Colors } from './color'
3+
import { Poppins } from 'next/font/google'
4+
5+
const poppins = Poppins({
6+
weight: ['400', '500', '600', '700'],
7+
subsets: ['latin'],
8+
fallback: ['Helvetica Neue', 'Arial', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', 'sans-serif']
9+
})
310

411
const { breakpoints } = createTheme()
512
const defaultTheme = createTheme({
@@ -79,21 +86,7 @@ export const theme: ThemeOptions = {
7986
MuiTypography: {
8087
defaultProps: {
8188
color: Colors.text.primary,
82-
fontFamily: [
83-
'Poppins',
84-
'Montserrat',
85-
'-apple-system',
86-
'BlinkMacSystemFont',
87-
'Segoe UI',
88-
'Roboto',
89-
'Oxygen',
90-
'Ubuntu',
91-
'Cantarell',
92-
'Fira Sans',
93-
'Droid Sans',
94-
'Helvetica Neue',
95-
'sans-serif'
96-
].join(',')
89+
fontFamily: poppins.style.fontFamily
9790
}
9891
}
9992
}

0 commit comments

Comments
 (0)