Skip to content

Commit 98c7c13

Browse files
[+] add SQL syntax highlighting to webui InitSQL popup (#1317)
1 parent 393b952 commit 98c7c13

File tree

1 file changed

+10
-8
lines changed
  • internal/webui/src/pages/MetricsPage/components/MetricsGrid/components/TextPopUp

1 file changed

+10
-8
lines changed

internal/webui/src/pages/MetricsPage/components/MetricsGrid/components/TextPopUp/TextPopUp.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import DescriptionOutlinedIcon from '@mui/icons-material/DescriptionOutlined';
44
import RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline';
55
import { Box, Dialog, DialogContent, DialogTitle, IconButton, Tooltip, Typography } from "@mui/material";
66
import ReactMarkdown from 'react-markdown';
7+
import SyntaxHighlighter from "react-syntax-highlighter";
8+
import { atomOneLight } from "react-syntax-highlighter/dist/esm/styles/hljs";
79

810
type Props = {
911
title: string;
@@ -60,18 +62,18 @@ export const TextPopUp = ({ title, content, type = "description" }: Props) => {
6062
}}
6163
>
6264
{type === "sql" ? (
63-
<Typography
64-
component="pre"
65-
sx={{
66-
margin: 0,
67-
fontFamily: "monospace",
65+
<SyntaxHighlighter
66+
language="sql"
67+
style={atomOneLight}
68+
wrapLongLines
69+
customStyle={{
6870
fontSize: "0.875rem",
69-
whiteSpace: "pre-wrap",
70-
wordBreak: "break-word",
71+
borderRadius: "4px",
72+
margin: 0,
7173
}}
7274
>
7375
{content}
74-
</Typography>
76+
</SyntaxHighlighter>
7577
) : (
7678
<Box sx={{
7779
'& p': { marginTop: 0, marginBottom: 1 },

0 commit comments

Comments
 (0)