From 5569aa278cc7f5580151e6f990740ce631b28410 Mon Sep 17 00:00:00 2001 From: Dhravya Date: Wed, 12 Jun 2024 23:37:06 -0500 Subject: =?UTF-8?q?chat=20UI=20and=20markdown=20renderer=20=E2=9A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/app/(dash)/chat/CodeBlock.tsx | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 apps/web/app/(dash)/chat/CodeBlock.tsx (limited to 'apps/web/app/(dash)/chat/CodeBlock.tsx') diff --git a/apps/web/app/(dash)/chat/CodeBlock.tsx b/apps/web/app/(dash)/chat/CodeBlock.tsx new file mode 100644 index 00000000..e83b1dee --- /dev/null +++ b/apps/web/app/(dash)/chat/CodeBlock.tsx @@ -0,0 +1,90 @@ +import React, { useRef, useState } from "react"; + +const CodeBlock = ({ + lang, + codeChildren, +}: { + lang: string; + codeChildren: React.ReactNode & React.ReactNode[]; +}) => { + const codeRef = useRef(null); + + return ( +
+ +
+ + {codeChildren} + +
+
+ ); +}; + +const CodeBar = React.memo( + ({ + lang, + codeRef, + }: { + lang: string; + codeRef: React.RefObject; + }) => { + const [isCopied, setIsCopied] = useState(false); + return ( +
+ {lang} + +
+ ); + }, +); +export default CodeBlock; -- cgit v1.2.3 From a20163d7ea54ff74b6108a18a8921391951d60eb Mon Sep 17 00:00:00 2001 From: Dhravya Date: Wed, 12 Jun 2024 23:42:55 -0500 Subject: make header and menu fixed instead of absolute to prevent movement on scroll --- apps/web/app/(dash)/chat/CodeBlock.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/web/app/(dash)/chat/CodeBlock.tsx') diff --git a/apps/web/app/(dash)/chat/CodeBlock.tsx b/apps/web/app/(dash)/chat/CodeBlock.tsx index e83b1dee..f9929f70 100644 --- a/apps/web/app/(dash)/chat/CodeBlock.tsx +++ b/apps/web/app/(dash)/chat/CodeBlock.tsx @@ -71,7 +71,7 @@ const CodeBar = React.memo( viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="size-6" + className="size-4" > Date: Thu, 13 Jun 2024 18:49:43 -0500 Subject: small stuff --- apps/web/app/(dash)/chat/CodeBlock.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/web/app/(dash)/chat/CodeBlock.tsx') diff --git a/apps/web/app/(dash)/chat/CodeBlock.tsx b/apps/web/app/(dash)/chat/CodeBlock.tsx index f9929f70..0bb6a19d 100644 --- a/apps/web/app/(dash)/chat/CodeBlock.tsx +++ b/apps/web/app/(dash)/chat/CodeBlock.tsx @@ -53,7 +53,7 @@ const CodeBar = React.memo( viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="size-6" + className="size-4" >