From 198965e983240bd9015e3199d17758db9a4d713f Mon Sep 17 00:00:00 2001 From: JingZhang Chen Date: Sat, 31 Aug 2024 04:21:01 +0800 Subject: [PATCH] clean code --- .../src/theme/CodeBlock/Content/String.tsx | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx index 820228eb4713..4f2e70b3a9a2 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx @@ -62,6 +62,19 @@ export default function CodeBlockString({ const showLineNumbers = showLineNumbersProp ?? containsLineNumbers(metastring); + function ButtonGroup() { + return
+ {(wordWrap.isEnabled || wordWrap.isCodeScrollable) && ( + wordWrap.toggle()} + isEnabled={wordWrap.isEnabled} + /> + )} + +
+} + return ( {title} - {title && ( -
- {(wordWrap.isEnabled || wordWrap.isCodeScrollable) && ( - wordWrap.toggle()} - isEnabled={wordWrap.isEnabled} - /> - )} - -
- )} + )}
@@ -119,18 +121,7 @@ export default function CodeBlockString({ )} - {!title && ( -
- {(wordWrap.isEnabled || wordWrap.isCodeScrollable) && ( - wordWrap.toggle()} - isEnabled={wordWrap.isEnabled} - /> - )} - -
- )} + {!title && }
);