Skip to content

Commit

Permalink
perf(ui): use fonts from next/font/google
Browse files Browse the repository at this point in the history
fix #589
  • Loading branch information
mateusfg7 committed Jul 18, 2023
1 parent 3a2d9f2 commit 2ba632b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
27 changes: 15 additions & 12 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from 'next'
import { Chivo_Mono, Inter } from 'next/font/google'
import { config } from 'global-config'

import { Providers } from './providers'
Expand All @@ -25,6 +26,19 @@ export const metadata: Metadata = {
}
}

const chivoMono = Chivo_Mono({
subsets: ['latin'],
weight: ['500'],
variable: '--font-chivo-mono',
display: 'swap'
})
const inter = Inter({
subsets: ['latin'],
weight: ['200', '300', '400', '500', '600', '700', '900'],
variable: '--font-inter',
display: 'swap'
})

export default function RootLayout({
children
}: {
Expand All @@ -33,18 +47,7 @@ export default function RootLayout({
return (
<html lang="en" className="scroll-smooth">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossOrigin="anonymous"
/>
<link
href="https://fonts.googleapis.com/css2?family=Chivo+Mono:wght@500&family=Source+Sans+Pro:wght@300;400;600&family=Inter:wght@200;300;400;500;600;700;900&display=swap"
rel="stylesheet"
/>
<link rel="shortcut icon" href="assets/brain.png" type="image/png" />

<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex/dist/katex.css"
Expand All @@ -56,7 +59,7 @@ export default function RootLayout({
data-website-id={process.env.UMAMI_WEBSITE_ID}
/>
</head>
<body className="scroll-smooth">
<body className={`scroll-smooth ${chivoMono.variable} ${inter.variable}`}>
<Providers>{children}</Providers>
</body>
</html>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

body {
@apply bg-neutral-100 dark:bg-neutral-1000;
@apply font-['Inter'] text-neutral-900 dark:text-neutral-300;
@apply font-sans text-neutral-900 dark:text-neutral-300;
}

/* Syntax Highlighting */
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module.exports = {
20: '20deg'
},
fontFamily: {
'chivo-mono': ['"Chivo Mono"', 'cursive']
'chivo-mono': 'var(--font-chivo-mono)',
sans: 'var(--font-inter)'
},
colors: {
neutral: {
Expand Down

0 comments on commit 2ba632b

Please sign in to comment.