mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-06 00:44:17 +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();
|
||||
}
|
||||
const demoJsContent = `
|
||||
${importReactContent}
|
||||
import './index.css';
|
||||
${parsedSourceCode}
|
||||
${importReactContent}
|
||||
import './index.css';
|
||||
${parsedSourceCode}
|
||||
`.trim();
|
||||
const indexCssContent = (style || '')
|
||||
.trim()
|
||||
@ -315,12 +315,11 @@ const CodePreviewer: React.FC<IPreviewerProps> = (props) => {
|
||||
.replace('</style>', '')
|
||||
.replace('<style>', '');
|
||||
|
||||
const indexJsContent = `
|
||||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import Demo from './demo';
|
||||
const indexJsContent = `import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import Demo from './demo';
|
||||
|
||||
createRoot(document.getElementById('container')).render(<Demo />);
|
||||
createRoot(document.getElementById('container')).render(<Demo />);
|
||||
`;
|
||||
|
||||
const codesandboxPackage = {
|
||||
|
Loading…
Reference in New Issue
Block a user