From 34265613b80d1d2249d276da5fcd5e4c274af357 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 14 May 2024 12:16:04 +0700 Subject: feat(ui): add history explore (#2022) * break out HistoryRow, add drawer * syntax highlighting! * smaller text * allow inspecting all old commands, no drag command * fix query bug * add loader --- ui/src/components/CodeBlock.tsx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ui/src/components/CodeBlock.tsx (limited to 'ui/src/components/CodeBlock.tsx') diff --git a/ui/src/components/CodeBlock.tsx b/ui/src/components/CodeBlock.tsx new file mode 100644 index 00000000..a4c34784 --- /dev/null +++ b/ui/src/components/CodeBlock.tsx @@ -0,0 +1,35 @@ +import { Highlight, themes } from "prism-react-renderer"; +import Prism from "prismjs"; +import "prismjs/components/prism-bash"; + +export default function CodeBlock({ code, language }: any) { + return ( +
+ + {({ className, style, tokens, getLineProps, getTokenProps }) => ( +
+            {tokens.map((line, i) => (
+              
+ {i == 0 && ( + $ + )} + {line.map((token, key) => ( + + ))} +
+ ))} +
+ )} +
+
+ ); +} -- cgit v1.3.1