Skip to content

Commit

Permalink
fix(deps): update dependency react-code-preview-layout to v3 #217
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Apr 23, 2023
1 parent b33cdee commit fbdee27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion website/package.json
Expand Up @@ -15,7 +15,7 @@
"@uiw/reset.css": "~1.0.5",
"@wcj/dark-mode": "~1.0.9",
"react": "~18.2.0",
"react-code-preview-layout": "~2.1.0",
"react-code-preview-layout": "^3.0.0",
"react-dom": "~18.2.0",
"react-router-dom": "^6.8.1"
},
Expand Down
28 changes: 13 additions & 15 deletions website/src/preview/index.tsx
Expand Up @@ -45,22 +45,20 @@ export const Preview = () => {
if (metaId && typeof Child === 'function') {
const code = MDStr.data[metaId].value || '';
const param = getURLParameters(metaData);
const disablePreview = getBooleanValue(param, 'disablePreview', false);
return (
<CodeLayout
disableCheckered={getBooleanValue(param, 'disableCheckered', true)}
disableToolbar={getBooleanValue(param, 'disableToolbar', false)}
disableCode={getBooleanValue(param, 'disableCode', false)}
disablePreview={getBooleanValue(param, 'disablePreview', false)}
bordered={getBooleanValue(param, 'bordered', true)}
copied={getBooleanValue(param, 'copied', true)}
background={param.background}
toolbar={param.title || '示例'}
codeProps={{ style: { padding: 0 } }}
style={{ padding: 0 }}
code={<pre {...(props as React.HTMLAttributes<HTMLPreElement>)} />}
text={code}
>
<Child />
<CodeLayout bordered={getBooleanValue(param, 'bordered', true)} style={{ marginBottom: '16px' }}>
{!disablePreview && (
<CodeLayout.Preview style={{ background: param.background }}>
<Child />
</CodeLayout.Preview>
)}
<CodeLayout.Toolbar copied={getBooleanValue(param, 'copied', true)} text={code}>
{param.title || 'Example'}
</CodeLayout.Toolbar>
<CodeLayout.Code style={{ padding: 0 }}>
<pre {...(props as React.HTMLAttributes<HTMLPreElement>)} />
</CodeLayout.Code>
</CodeLayout>
);
}
Expand Down

0 comments on commit fbdee27

Please sign in to comment.