Skip to content

Commit c78c5f1

Browse files
committed
Try browser only
1 parent 087d88a commit c78c5f1

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,18 @@ Most changes are reflected live without having to restart the server.
5656

5757
To build the website locally, or to test/preview the build process that will run in CI.
5858

59-
```sh {"id":"01HPS5TSQ025AQBEY5C5R7BQK4","name":"npm-run-build"}
59+
```sh {"id":"01HPS5TSQ025AQBEY5C5R7BQK4","name":"build"}
6060
npm run build
6161
```
6262

6363
This command generates static content into the `build` directory and can be served using any static contents hosting service.
6464

65+
### Serve locally
66+
67+
```sh {"id":"01HTMQZMYX58ZX7PK297YNYZ36","name":"serve"}
68+
cd build; python -m http.server 9000
69+
```
70+
6571
### Deployment
6672

6773
This website is auto-deployed via Vercel's GitHub integration, when your branch is merged into main.

src/components/ExamplesPage.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import BrowserOnly from '@docusaurus/BrowserOnly';
12
import React, { useEffect, useState } from "react";
23
import Layout from "@theme/Layout";
34

@@ -15,6 +16,16 @@ import {
1516
} from "@fortawesome/free-solid-svg-icons";
1617
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
1718

19+
export default function (props) {
20+
return (
21+
<BrowserOnly fallback={<div>Loading...</div>}>
22+
{() => {
23+
return <ExamplesPage {...props} />;
24+
}}
25+
</BrowserOnly>
26+
);
27+
}
28+
1829
function ExampleLayout({ children }) {
1930
return (
2031
<Layout>
@@ -28,7 +39,7 @@ function ExampleLayout({ children }) {
2839
)
2940
}
3041

31-
export default function ExamplesPage({ examples, example }) {
42+
function ExamplesPage({ examples, example }) {
3243
if (example) {
3344
return (
3445
<ExampleLayout>

0 commit comments

Comments
 (0)