Skip to content

Commit

Permalink
fix: fix markdown component text overflow (#209) (#210)
Browse files Browse the repository at this point in the history
Co-authored-by: Fran McDade <[email protected]>
  • Loading branch information
frano-m and Fran McDade authored Sep 27, 2024
1 parent d5f4226 commit 5f97fb6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/common/Markdown/markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
// TODO deprecate component if possible (see MDXMarkdown)
import { Box as MBox, BoxProps as MBoxProps } from "@mui/material";
import DOMPurify from "isomorphic-dompurify";
import React from "react";

export interface MarkdownProps {
content: string;
sx?: MBoxProps["sx"];
}

export const Markdown = ({ content }: MarkdownProps): JSX.Element => {
export const Markdown = ({ content, sx }: MarkdownProps): JSX.Element => {
return (
<div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }} />
<MBox
component="div"
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }}
sx={{ minWidth: 0, wordBreak: "break-word", ...sx }}
/>
);
};

0 comments on commit 5f97fb6

Please sign in to comment.