Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-infra] Fix Code Sandbox download issue #39317

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/src/modules/sandbox/CodeSandbox.test.js
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ describe('CodeSandbox', () => {
</body>
</html>`,
},
'Demo.js': {
'src/Demo.js': {
content: `import * as React from 'react';
import Stack from '@mui/material/Stack';
import Button from '@mui/material/Button';
@@ -83,7 +83,7 @@ export default function BasicButtons() {
}
`,
},
'index.js': {
'src/index.js': {
content: `import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { StyledEngineProvider } from '@mui/material/styles';
@@ -157,7 +157,7 @@ ReactDOM.createRoot(document.querySelector("#root")).render(
</body>
</html>`,
},
'Demo.tsx': {
'src/Demo.tsx': {
content: `import * as React from 'react';
import Stack from '@mui/material/Stack';
import Button from '@mui/material/Button';
@@ -173,7 +173,7 @@ export default function BasicButtons() {
}
`,
},
'index.tsx': {
'src/index.tsx': {
content: `import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { StyledEngineProvider } from '@mui/material/styles';
6 changes: 3 additions & 3 deletions docs/src/modules/sandbox/CodeSandbox.ts
Original file line number Diff line number Diff line change
@@ -41,10 +41,10 @@ const createReactApp = (demoData: DemoData) => {
'public/index.html': {
content: CRA.getHtml(demoData),
},
[`index.${ext}`]: {
[`src/index.${ext}`]: {
content: CRA.getRootIndex(demoData),
},
[`Demo.${ext}`]: {
[`src/Demo.${ext}`]: {
content: demoData.raw,
},
...(demoData.codeVariant === 'TS' && {
@@ -83,7 +83,7 @@ const createReactApp = (demoData: DemoData) => {
* @description should start with `/`, e.g. `/Demo.tsx`. If the extension is not provided,
* it will be appended based on the code variant.
*/
openSandbox: (initialFile: string = `/Demo.${ext}`) =>
openSandbox: (initialFile: string = `/src/Demo.${ext}`) =>
openSandbox({ files, codeVariant: demoData.codeVariant, initialFile }),
};
};
Loading