Skip to content

Commit ca9ecbd

Browse files
committed
chore(website): Updated fonts for latest nextjs build optimizations
1 parent b629e3e commit ca9ecbd

File tree

9 files changed

+27
-91
lines changed

9 files changed

+27
-91
lines changed

packages/documentation/src/components/Code/InternalCode.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/documentation/src/components/Code/InternalCodeBlock.tsx

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default as Code } from "./InternalCode";
2-
export { default as CodeBlock } from "./InternalCodeBlock";
1+
export { default as Code } from "./Code";
2+
export { default as CodeBlock } from "./CodeBlock";

packages/documentation/src/components/Demos/DemoPage.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, { ReactElement } from "react";
22
import cn from "classnames";
33
import { defaults } from "lodash";
4+
import Head from "next/head";
45

56
import { toId } from "utils/toTitle";
67

78
import Demo from "./Demo";
89
import DemoPageHeader from "./DemoPageHeader";
9-
import DemoPageFont from "./DemoPageFont";
1010
import { DemoPageConfig, DemoProps, DemoConfig } from "./types";
1111

1212
import styles from "./DemoPage.module.scss";
@@ -47,9 +47,20 @@ export default function DemoPage(props: DemoPageProps): ReactElement {
4747
} = props;
4848
return (
4949
<div id="demo-page-container" className={cn(styles.container, className)}>
50-
{fonts.map((font) => (
51-
<DemoPageFont font={font} key={font} />
52-
))}
50+
<Head>
51+
{fonts.map((font) => {
52+
let href: string;
53+
if (font === "Font Awesome") {
54+
href =
55+
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css";
56+
} else {
57+
const name = font.replace(/\s+/g, "+");
58+
href = `https://fonts.googleapis.com/css2?family=${name}&display=swap`;
59+
}
60+
61+
return <link key={font} rel="stylesheet" href={href} />;
62+
})}
63+
</Head>
5364
<DemoPageHeader packageName={packageName}>{description}</DemoPageHeader>
5465
{demos.map((demo, index) => (
5566
// eslint-disable-next-line react/jsx-key

packages/documentation/src/components/Demos/DemoPageFont.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/documentation/src/components/GoogleFont.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/documentation/src/components/Markdown/Markdown.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import React, {
1111
import cn from "classnames";
1212
import { useRouter } from "next/router";
1313

14-
import GoogleFont from "components/GoogleFont";
15-
1614
import styles from "./Markdown.module.scss";
1715
import { markdownToHTML } from "./utils";
1816

@@ -116,7 +114,6 @@ export default function Markdown({
116114

117115
return (
118116
<>
119-
<GoogleFont font="Source Code Pro" />
120117
<div
121118
{...props}
122119
ref={ref}

packages/documentation/src/pages/_app.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
DEFAULT_TABLET_MIN_WIDTH,
1414
} from "@react-md/utils";
1515
import MobileDetect from "mobile-detect";
16-
import GoogleFont from "components/GoogleFont";
1716
import Layout from "components/Layout";
1817
import Theme, { getDefaultTheme, ThemeMode } from "components/Theme";
1918
import { GA_CODE } from "constants/github";
@@ -168,8 +167,6 @@ export default class App extends NextApp<AppProps> {
168167

169168
return (
170169
<>
171-
<GoogleFont font="Roboto:400,500,700" />
172-
<GoogleFont font="Source Code Pro" />
173170
<Head>
174171
<meta
175172
name="viewport"

packages/documentation/src/pages/_document.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@ export default class MyDocument extends Document<MyDocumentProps> {
4242
const { theme } = this.props;
4343
return (
4444
<Html lang="en" dir="ltr" className={`${theme}-theme`}>
45-
<Head />
45+
<Head>
46+
<link
47+
rel="stylesheet"
48+
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
49+
/>
50+
<link
51+
rel="stylesheet"
52+
href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap"
53+
/>
54+
</Head>
4655
<body>
4756
<Main />
4857
<script dangerouslySetInnerHTML={{ __html: PRISM_MANUAL_MODE }} />

0 commit comments

Comments
 (0)