From ba124c1673b8a1694cab7ee7a724ffe10e3d6a13 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 7 Apr 2025 23:16:43 -0700 Subject: [PATCH] Just checking in --- frontend/src/StyledMarkdown.tsx | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 frontend/src/StyledMarkdown.tsx diff --git a/frontend/src/StyledMarkdown.tsx b/frontend/src/StyledMarkdown.tsx new file mode 100644 index 0000000..8343a23 --- /dev/null +++ b/frontend/src/StyledMarkdown.tsx @@ -0,0 +1,48 @@ +import React from 'react'; +import { MuiMarkdown } from 'mui-markdown'; +import { useTheme } from '@mui/material/styles'; +import { Link } from '@mui/material'; +import { ChatQuery } from './Message'; + +interface StyledMarkdownProps { + content: string, + submitQuery?: (query: string) => void, + [key: string]: any, // For any additional props +}; + +const StyledMarkdown: React.FC = ({ content, submitQuery, ...props }) => { + const theme = useTheme(); + + let options: any = { + overrides: { + a: { + component: Link, + props: { + sx: { + wordBreak: "break-all", + color: theme.palette.secondary.main, + textDecoration: 'none', + '&:hover': { + color: theme.palette.custom.highlight, + textDecoration: 'underline', + } + } + } + }, + ChatQuery: undefined + }, + }; + + if (submitQuery) { + options.overrides.ChatQuery = { + component: ChatQuery, + props: { + submitQuery + }, + }; + } + + return ; +}; + +export { StyledMarkdown }; \ No newline at end of file