Skip to content

Commit

Permalink
chore: fix box demo
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Dec 24, 2024
1 parent c650fe3 commit e95027d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 6 additions & 2 deletions site/src/components/stackblitz/content.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import orgPkg from '../../../../package.json';

export const htmlContent = `
<div id="app" style="padding: 24px;"></div>
<div id="app"></div>
<script type="module" src="/src/index.jsx"></script>
`;

export const mainJsContent = `
import React from 'react';
import React, { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import Demo from './demo';
Expand Down Expand Up @@ -105,10 +106,13 @@ export const packageJSONContent = JSON.stringify(
'react-dom': orgPkg.devDependencies['react-dom'],
'tdesign-react': orgPkg.version,
'tdesign-icons-react': orgPkg.dependencies['tdesign-icons-react'],
'@types/react': orgPkg.devDependencies['@types/react'],
'@types/react-dom': orgPkg.devDependencies['@types/react-dom'],
},
devDependencies: {
vite: orgPkg.devDependencies.vite,
'@vitejs/plugin-react': orgPkg.devDependencies['@vitejs/plugin-react'],
typescript: orgPkg.devDependencies.typescript,
},
},
null,
Expand Down
6 changes: 3 additions & 3 deletions site/src/components/stackblitz/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default function Stackblitz(props) {
setIsTypeScriptDemo(isTypeScriptDemo);

setTimeout(() => {
console.log(formRef.current, 111);
formRef.current.submit();
});
}
Expand All @@ -35,7 +34,7 @@ export default function Stackblitz(props) {
<form
ref={formRef}
method="post"
action="https://stackblitz.com/run?file=package.json,src%2Fdemo.tsx"
action={`https://stackblitz.com/run?file=src%2F${isTypeScriptDemo ? 'demo.tsx' : 'demo.jsx'}`}
target="_blank"
onClick={submit}
>
Expand All @@ -48,11 +47,12 @@ export default function Stackblitz(props) {
<input type="hidden" name="project[files][src/demo.jsx]" value={code} />
)}
<input type="hidden" name="project[files][src/index.css]" value={styleContent} />
<input type="hidden" name="project[files][src/index.js]" value={mainJsContent} />
<input type="hidden" name="project[files][src/index.jsx]" value={mainJsContent} />
<input type="hidden" name="project[files][index.html]" value={htmlContent} />
<input type="hidden" name="project[files][vite.config.js]" value={viteConfigContent} />
<input type="hidden" name="project[files][.stackblitzrc]" value={stackblitzRc} />
<input type="hidden" name="project[files][package.json]" value={packageJSONContent} />
<input type="hidden" name="project[template]" value="node" />

<div className="action-online">
<svg viewBox="0 0 28 28" height="20">
Expand Down
4 changes: 1 addition & 3 deletions src/form/_example/form-field-linkage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import Form from '../Form';
import Radio from '../../radio';
import Button from '../../button';
import { Form, Radio, Button } from 'tdesign-react';

const { FormItem } = Form;

Expand Down

0 comments on commit e95027d

Please sign in to comment.