2022-08-15 00:43:56 +02:00
|
|
|
import { createStyles, Text, TypographyStylesProvider } from "@mantine/core"
|
2022-08-13 10:56:07 +02:00
|
|
|
|
|
|
|
|
export interface ContentProps {
|
|
|
|
|
content: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const useStyles = createStyles(theme => ({
|
|
|
|
|
content: {
|
|
|
|
|
// break long links or long words
|
|
|
|
|
overflowWrap: "anywhere",
|
|
|
|
|
"& a": {
|
|
|
|
|
color: theme.fn.variant({ color: theme.primaryColor, variant: "subtle" }).color,
|
|
|
|
|
},
|
|
|
|
|
"& img": {
|
|
|
|
|
maxWidth: "100%",
|
|
|
|
|
height: "auto",
|
|
|
|
|
},
|
|
|
|
|
"& iframe": {
|
|
|
|
|
maxWidth: "100%",
|
|
|
|
|
},
|
|
|
|
|
"& pre, & code": {
|
|
|
|
|
whiteSpace: "pre-wrap",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
export function Content(props: ContentProps) {
|
|
|
|
|
const { classes } = useStyles()
|
2022-08-15 00:43:56 +02:00
|
|
|
return (
|
|
|
|
|
<TypographyStylesProvider>
|
|
|
|
|
<Text size="md" className={classes.content} dangerouslySetInnerHTML={{ __html: props.content }} />
|
|
|
|
|
</TypographyStylesProvider>
|
|
|
|
|
)
|
2022-08-13 10:56:07 +02:00
|
|
|
}
|