Skip to content

Commit

Permalink
chore(website): Updated fonts for latest nextjs build optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Sep 8, 2021
1 parent b629e3e commit ca9ecbd
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 91 deletions.
14 changes: 0 additions & 14 deletions packages/documentation/src/components/Code/InternalCode.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions packages/documentation/src/components/Code/InternalCodeBlock.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions packages/documentation/src/components/Code/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as Code } from "./InternalCode";
export { default as CodeBlock } from "./InternalCodeBlock";
export { default as Code } from "./Code";
export { default as CodeBlock } from "./CodeBlock";
19 changes: 15 additions & 4 deletions packages/documentation/src/components/Demos/DemoPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { ReactElement } from "react";
import cn from "classnames";
import { defaults } from "lodash";
import Head from "next/head";

import { toId } from "utils/toTitle";

import Demo from "./Demo";
import DemoPageHeader from "./DemoPageHeader";
import DemoPageFont from "./DemoPageFont";
import { DemoPageConfig, DemoProps, DemoConfig } from "./types";

import styles from "./DemoPage.module.scss";
Expand Down Expand Up @@ -47,9 +47,20 @@ export default function DemoPage(props: DemoPageProps): ReactElement {
} = props;
return (
<div id="demo-page-container" className={cn(styles.container, className)}>
{fonts.map((font) => (
<DemoPageFont font={font} key={font} />
))}
<Head>
{fonts.map((font) => {
let href: string;
if (font === "Font Awesome") {
href =
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css";
} else {
const name = font.replace(/\s+/g, "+");
href = `https://fonts.googleapis.com/css2?family=${name}&display=swap`;
}

return <link key={font} rel="stylesheet" href={href} />;
})}
</Head>
<DemoPageHeader packageName={packageName}>{description}</DemoPageHeader>
{demos.map((demo, index) => (
// eslint-disable-next-line react/jsx-key
Expand Down
26 changes: 0 additions & 26 deletions packages/documentation/src/components/Demos/DemoPageFont.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions packages/documentation/src/components/GoogleFont.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions packages/documentation/src/components/Markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import React, {
import cn from "classnames";
import { useRouter } from "next/router";

import GoogleFont from "components/GoogleFont";

import styles from "./Markdown.module.scss";
import { markdownToHTML } from "./utils";

Expand Down Expand Up @@ -116,7 +114,6 @@ export default function Markdown({

return (
<>
<GoogleFont font="Source Code Pro" />
<div
{...props}
ref={ref}
Expand Down
3 changes: 0 additions & 3 deletions packages/documentation/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
DEFAULT_TABLET_MIN_WIDTH,
} from "@react-md/utils";
import MobileDetect from "mobile-detect";
import GoogleFont from "components/GoogleFont";
import Layout from "components/Layout";
import Theme, { getDefaultTheme, ThemeMode } from "components/Theme";
import { GA_CODE } from "constants/github";
Expand Down Expand Up @@ -168,8 +167,6 @@ export default class App extends NextApp<AppProps> {

return (
<>
<GoogleFont font="Roboto:400,500,700" />
<GoogleFont font="Source Code Pro" />
<Head>
<meta
name="viewport"
Expand Down
11 changes: 10 additions & 1 deletion packages/documentation/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ export default class MyDocument extends Document<MyDocumentProps> {
const { theme } = this.props;
return (
<Html lang="en" dir="ltr" className={`${theme}-theme`}>
<Head />
<Head>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap"
/>
</Head>
<body>
<Main />
<script dangerouslySetInnerHTML={{ __html: PRISM_MANUAL_MODE }} />
Expand Down

0 comments on commit ca9ecbd

Please sign in to comment.