From dfb870df0af96f2626144966ad54bf17b836e1d8 Mon Sep 17 00:00:00 2001 From: AyushShivhare79 Date: Wed, 21 Aug 2024 14:58:34 +0530 Subject: [PATCH] feat(refactor & style): code-block, code-text, copy-button --- apps/web/components/CodeBlock.module.css | 36 +++------------- apps/web/components/CodeBlock.tsx | 54 +++++++++++++++--------- apps/web/components/NotionRenderer.tsx | 2 +- 3 files changed, 39 insertions(+), 53 deletions(-) diff --git a/apps/web/components/CodeBlock.module.css b/apps/web/components/CodeBlock.module.css index 5f3fac2e..411e0e7e 100644 --- a/apps/web/components/CodeBlock.module.css +++ b/apps/web/components/CodeBlock.module.css @@ -1,4 +1,6 @@ .code_block { + display: flex; + justify-content: space-between; position: relative; padding: 10px; font-size: 15px; @@ -6,35 +8,7 @@ white-space: pre-wrap; background: #020617; overflow: auto; - line-height: 1.6; - border: 1px solid #10b981; - border-left: 2px solid #b91c1c; + border: 2px solid #10b981; + border-left: 3px solid #3b82f6; color: #564; - min-width: 200px; - width: 800px; - display: flex; - justify-content: space-between; -} - -.copy_block { - display: flex; - flex-direction: column; - justify-content: flex-start; -} - -.copy_button { - position: relative; - cursor: pointer; - color: #fff; - background: gray; - border-radius: 0.5em; - padding: 2px 7px; - margin: 10px; -} - -.copied_text { - background: #fff; - padding: 5px; - color: #161b22; - display: none; -} +} \ No newline at end of file diff --git a/apps/web/components/CodeBlock.tsx b/apps/web/components/CodeBlock.tsx index 1292b41e..4f2af3cc 100644 --- a/apps/web/components/CodeBlock.tsx +++ b/apps/web/components/CodeBlock.tsx @@ -14,27 +14,39 @@ export default function CodeBlock({ block }: { block: any }) { const [showCopiedMessage, setShowCopiedMessage] = useState(false); - return ( -
-
- -
-
-
-          {code}
-        
+ return ( +
+ +
+
+ +
+
+
+            {code}
+          
+
); diff --git a/apps/web/components/NotionRenderer.tsx b/apps/web/components/NotionRenderer.tsx index 2e19ab25..5ef73c29 100644 --- a/apps/web/components/NotionRenderer.tsx +++ b/apps/web/components/NotionRenderer.tsx @@ -19,7 +19,7 @@ export const NotionRenderer = ({ recordMap }: { recordMap: any }) => { .dark-mode { background: #111827; color: #ffffff - } + } .notion-title{ font-family: open-montserrat; font-size: xxx-large;