chore: fix docs build

This commit is contained in:
mathuo 2024-04-27 13:37:55 +01:00
parent 9c091f5126
commit f6e816fa10
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
2 changed files with 6 additions and 18 deletions

View File

@ -3,7 +3,7 @@
"version": "1.13.0", "version": "1.13.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "npm run create-templates && docusaurus build", "build": "npm run build-templates && docusaurus build",
"clear": "docusaurus clear", "clear": "docusaurus clear",
"start": "concurrently \"docusaurus start\" \"npm run start-esm-server\"", "start": "concurrently \"docusaurus start\" \"npm run start-esm-server\"",
"start-esm-server": "node web-server/index.mjs", "start-esm-server": "node web-server/index.mjs",

View File

@ -5,15 +5,11 @@ import BrowserOnly from '@docusaurus/BrowserOnly';
const BASE_SANDBOX_URL = const BASE_SANDBOX_URL =
'https://codesandbox.io/s/github/mathuo/dockview/tree/master/packages/docs'; 'https://codesandbox.io/s/github/mathuo/dockview/tree/master/packages/docs';
export const _CodeRunner = (props: { export const _CodeRunner = (props: { id: string; height: number }) => {
id: string; const [framework] = useActiveFramework();
framework: string;
height: number;
}) => {
useActiveFramework();
const sandboxUrl = `${BASE_SANDBOX_URL}/templates/${props.id}/${props.framework}`; const sandboxUrl = `${BASE_SANDBOX_URL}/templates/${props.id}/${framework}`;
const path = `/templates/${props.id}/${props.framework}/index.html`; const path = `/templates/${props.id}/${framework}/index.html`;
return ( return (
<div> <div>
<iframe <iframe
@ -35,15 +31,7 @@ export const _CodeRunner = (props: {
}; };
export const CodeRunner = (props: { id: string; height: number }) => { export const CodeRunner = (props: { id: string; height: number }) => {
const [framework] = useActiveFramework(); return <BrowserOnly>{() => <_CodeRunner {...props} />}</BrowserOnly>;
return (
<BrowserOnly>
{() => (
<_CodeRunner {...props} framework={framework.toLowerCase()} />
)}
</BrowserOnly>
);
}; };
const CodeSandbox = (props: { url: string }) => { const CodeSandbox = (props: { url: string }) => {