mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
site: Improve code formatting in Previewer component (#40813)
- Remove unnecessary whitespace in the Demo.tsx file - Replace `<style>` and `</style>` tags with empty strings in the index.css file - Move the React import statement to the top of the index.js file [.dumi/theme/builtins/Previewer/index.tsx] - Remove unnecessary whitespace in the Demo.tsx file - Replace `<style>` and `</style>` tags with empty strings in the index.css file - Move the React import statement to the top of the index.js file - Remove the unnecessary whitespace in the index.js file
This commit is contained in:
parent
853283b7e4
commit
0bfdff2086
@ -305,9 +305,9 @@ const CodePreviewer: React.FC<IPreviewerProps> = (props) => {
|
|||||||
parsedSourceCode = parsedSourceCode.replace(importReactReg, '').trim();
|
parsedSourceCode = parsedSourceCode.replace(importReactReg, '').trim();
|
||||||
}
|
}
|
||||||
const demoJsContent = `
|
const demoJsContent = `
|
||||||
${importReactContent}
|
${importReactContent}
|
||||||
import './index.css';
|
import './index.css';
|
||||||
${parsedSourceCode}
|
${parsedSourceCode}
|
||||||
`.trim();
|
`.trim();
|
||||||
const indexCssContent = (style || '')
|
const indexCssContent = (style || '')
|
||||||
.trim()
|
.trim()
|
||||||
@ -315,12 +315,11 @@ const CodePreviewer: React.FC<IPreviewerProps> = (props) => {
|
|||||||
.replace('</style>', '')
|
.replace('</style>', '')
|
||||||
.replace('<style>', '');
|
.replace('<style>', '');
|
||||||
|
|
||||||
const indexJsContent = `
|
const indexJsContent = `import React from 'react';
|
||||||
import React from 'react';
|
import { createRoot } from 'react-dom/client';
|
||||||
import { createRoot } from 'react-dom/client';
|
import Demo from './demo';
|
||||||
import Demo from './demo';
|
|
||||||
|
|
||||||
createRoot(document.getElementById('container')).render(<Demo />);
|
createRoot(document.getElementById('container')).render(<Demo />);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const codesandboxPackage = {
|
const codesandboxPackage = {
|
||||||
|
Loading…
Reference in New Issue
Block a user