diff --git a/.dumi/theme/builtins/Previewer/index.tsx b/.dumi/theme/builtins/Previewer/index.tsx index bf3b471c42db..36731e2e21c0 100644 --- a/.dumi/theme/builtins/Previewer/index.tsx +++ b/.dumi/theme/builtins/Previewer/index.tsx @@ -303,9 +303,18 @@ const Demo: React.FC = (props) => { if (suffix === 'tsx') { stackblitzPrefillConfig.files['tsconfig.json'] = tsconfig; } - let codeBox: React.ReactNode = ( + + const backgroundGrey = theme.includes('dark') ? '#303030' : '#f0f2f5'; + + const codeBoxDemoStyle: React.CSSProperties = { + padding: meta.iframe || meta.compact ? 0 : undefined, + overflow: meta.iframe || meta.compact ? 'hidden' : undefined, + backgroundColor: meta.background === 'grey' ? backgroundGrey : undefined, + }; + + const codeBox: React.ReactNode = (
-
+
{liveDemo.current} @@ -455,7 +464,7 @@ const Demo: React.FC = (props) => { ); if (meta.version) { - codeBox = ( + return ( {codeBox}