Skip to content

Commit

Permalink
fix: find the missing code (ant-design#40047)
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan authored Jan 6, 2023
1 parent e597fe8 commit 67e958f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .dumi/theme/builtins/Previewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,18 @@ const Demo: React.FC<DemoProps> = (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 = (
<section className={codeBoxClass} id={meta.id}>
<section className="code-box-demo" data-compact={meta.compact}>
<section className="code-box-demo" style={codeBoxDemoStyle}>
<ErrorBoundary>
<React.StrictMode>{liveDemo.current}</React.StrictMode>
</ErrorBoundary>
Expand Down Expand Up @@ -455,7 +464,7 @@ const Demo: React.FC<DemoProps> = (props) => {
);

if (meta.version) {
codeBox = (
return (
<Badge.Ribbon text={meta.version} color={meta.version.includes('<') ? 'red' : null}>
{codeBox}
</Badge.Ribbon>
Expand Down

0 comments on commit 67e958f

Please sign in to comment.