Skip to content

Commit 2249867

Browse files
committed
fix home page
1 parent dbcf747 commit 2249867

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/pages/index.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@ import React, { useRef } from 'react'
22
import clsx from 'clsx'
33
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
44
import Layout from '@theme/Layout'
5-
import ReactOnnx, { useOnnx } from '@wolanx/react-netron'
65

76
import styles from './index.module.css'
7+
import BrowserOnly from '@docusaurus/BrowserOnly'
8+
9+
function MyHome () {
10+
const mod = require('@wolanx/react-netron')
11+
const ReactOnnx = mod.default
12+
const useOnnx = mod.useOnnx
813

9-
export default function Home () {
1014
const { siteConfig } = useDocusaurusContext()
1115

1216
// https://github.com/onnx/models/blob/main/vision/classification/mnist/model/mnist-12.onnx
1317
const file = useOnnx('./model/demo.onnx')
1418
const ref = useRef(null)
15-
1619
return (
17-
<Layout
18-
title={`Hello from ${siteConfig.title}`}
19-
description="Description will go into a meta tag in <head />">
20+
<>
2021
<header className={clsx('hero hero--primary', styles.heroBanner)}>
2122
<div className="container">
2223
<h1 className="hero__title">{siteConfig.title}</h1>
@@ -29,6 +30,20 @@ export default function Home () {
2930
<main>
3031
<ReactOnnx ref={ref} width={'100%'} height={600} file={file}/>
3132
</main>
33+
</>
34+
)
35+
}
36+
37+
export default function Home () {
38+
const { siteConfig } = useDocusaurusContext()
39+
40+
return (
41+
<Layout
42+
title={`Hello from ${siteConfig.title}`}
43+
description="Description will go into a meta tag in <head />">
44+
<BrowserOnly fallback={<div>Loading...</div>}>
45+
{MyHome}
46+
</BrowserOnly>
3247
</Layout>
3348
)
3449
}

0 commit comments

Comments
 (0)