mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Redesign add plugins page
This commit is contained in:
parent
5936ed10ca
commit
e928a2ff95
26 changed files with 1022 additions and 241 deletions
31
src/components/MarkdownBox.tsx
Normal file
31
src/components/MarkdownBox.tsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
import Box from '@mui/material/Box/Box';
|
||||
import DOMPurify from 'dompurify';
|
||||
import markdownIt from 'markdown-it';
|
||||
import React, { type FC } from 'react';
|
||||
|
||||
interface MarkdownBoxProps {
|
||||
markdown?: string | null
|
||||
fallback?: string
|
||||
}
|
||||
|
||||
/** A component to render Markdown content within a MUI Box component. */
|
||||
const MarkdownBox: FC<MarkdownBoxProps> = ({
|
||||
markdown,
|
||||
fallback
|
||||
}) => (
|
||||
<Box
|
||||
dangerouslySetInnerHTML={
|
||||
markdown ?
|
||||
{ __html: DOMPurify.sanitize(markdownIt({ html: true }).render(markdown)) } :
|
||||
undefined
|
||||
}
|
||||
sx={{
|
||||
'> :first-child': { marginTop: 0, paddingTop: 0 },
|
||||
'> :last-child': { marginBottom: 0, paddingBottom: 0 }
|
||||
}}
|
||||
>
|
||||
{markdown ? undefined : fallback}
|
||||
</Box>
|
||||
);
|
||||
|
||||
export default MarkdownBox;
|
Loading…
Add table
Add a link
Reference in a new issue