mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 21:57:06 +01:00
56481dd875
* snaps@0.37.0-flask.1 * Update LavaMoat policies * Add support for disabling markdown * Update execution env URL * Bump patch version
38 lines
850 B
JavaScript
38 lines
850 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import ReactMarkdown from 'react-markdown';
|
|
import {
|
|
TypographyVariant,
|
|
OVERFLOW_WRAP,
|
|
} from '../../../../helpers/constants/design-system';
|
|
import Typography from '../../../ui/typography/typography';
|
|
|
|
const Paragraph = (props) => (
|
|
<Typography
|
|
{...props}
|
|
variant={TypographyVariant.H6}
|
|
className="snap-ui-markdown__text"
|
|
overflowWrap={OVERFLOW_WRAP.BREAK_WORD}
|
|
/>
|
|
);
|
|
|
|
export const SnapUIMarkdown = ({ children, markdown }) => {
|
|
if (markdown === false) {
|
|
return <Paragraph>{children}</Paragraph>;
|
|
}
|
|
|
|
return (
|
|
<ReactMarkdown
|
|
allowedElements={['p', 'strong', 'em']}
|
|
components={{ p: Paragraph }}
|
|
>
|
|
{children}
|
|
</ReactMarkdown>
|
|
);
|
|
};
|
|
|
|
SnapUIMarkdown.propTypes = {
|
|
children: PropTypes.string,
|
|
markdown: PropTypes.bool,
|
|
};
|