Add better fallback
This commit is contained in:
@@ -110,7 +110,7 @@ function babelTransformTask(opts) {
|
|||||||
env: {
|
env: {
|
||||||
// Trigger distribution-specific Babel transforms
|
// Trigger distribution-specific Babel transforms
|
||||||
NODE_ENV: 'dist',
|
NODE_ENV: 'dist',
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
// @ts-ignore untyped from Emscripten
|
// @ts-ignore untyped from Emscripten
|
||||||
import loadYoga from '../binaries/web.js';
|
import loadYoga from '../binaries/web.js';
|
||||||
import wrapAssembly from './wrapAssembly.js';
|
import wrapAssembly from './wrapAssembly.ts';
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
Config,
|
Config,
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*"
|
"src/**/*",
|
||||||
|
"tests/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -28,3 +28,29 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.playgroundFallback {
|
||||||
|
height: 500px;
|
||||||
|
width: 100%;
|
||||||
|
background: linear-gradient(-90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
|
||||||
|
linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
|
||||||
|
linear-gradient(-90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
|
||||||
|
linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
|
||||||
|
linear-gradient(
|
||||||
|
transparent 4px,
|
||||||
|
#f5f5f5 4px,
|
||||||
|
#f5f5f5 97px,
|
||||||
|
transparent 97px
|
||||||
|
),
|
||||||
|
linear-gradient(-90deg, #e5e5e5 1px, transparent 1px),
|
||||||
|
linear-gradient(
|
||||||
|
-90deg,
|
||||||
|
transparent 4px,
|
||||||
|
#f5f5f5 4px,
|
||||||
|
#f5f5f5 97px,
|
||||||
|
transparent 97px
|
||||||
|
),
|
||||||
|
linear-gradient(#e5e5e5 1px, transparent 1px), #f5f5f5;
|
||||||
|
background-size: 10px 10px, 10px 10px, 100px 100px, 100px 100px, 100px 100px,
|
||||||
|
100px 100px, 100px 100px, 100px 100px;
|
||||||
|
}
|
||||||
|
@@ -36,6 +36,18 @@ function HomepageHeader() {
|
|||||||
|
|
||||||
const LazyPlayground = React.lazy(() => import('../components/Playground'));
|
const LazyPlayground = React.lazy(() => import('../components/Playground'));
|
||||||
|
|
||||||
|
function ClientPlayground() {
|
||||||
|
const fallback = <div className={styles.playgroundFallback} />;
|
||||||
|
return <BrowserOnly fallback={fallback}>
|
||||||
|
{() => (
|
||||||
|
<Suspense fallback={fallback}>
|
||||||
|
<LazyPlayground />
|
||||||
|
</Suspense>
|
||||||
|
)}
|
||||||
|
</BrowserOnly>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export default function Home(): JSX.Element {
|
export default function Home(): JSX.Element {
|
||||||
const {siteConfig} = useDocusaurusContext();
|
const {siteConfig} = useDocusaurusContext();
|
||||||
return (
|
return (
|
||||||
@@ -45,13 +57,7 @@ export default function Home(): JSX.Element {
|
|||||||
<HomepageHeader />
|
<HomepageHeader />
|
||||||
<main>
|
<main>
|
||||||
<HomepageFeatures />
|
<HomepageFeatures />
|
||||||
<BrowserOnly fallback={null}>
|
<ClientPlayground />
|
||||||
{() => (
|
|
||||||
<Suspense fallback={null}>
|
|
||||||
<LazyPlayground />
|
|
||||||
</Suspense>
|
|
||||||
)}
|
|
||||||
</BrowserOnly>
|
|
||||||
</main>
|
</main>
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user