mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 07:16:36 +01:00
a10fb75f35
Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
38 lines
824 B
JavaScript
38 lines
824 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import ReactMarkdown from 'react-markdown';
|
|
import {
|
|
TextVariant,
|
|
OverflowWrap,
|
|
} from '../../../../helpers/constants/design-system';
|
|
import { Text } from '../../../component-library';
|
|
|
|
const Paragraph = (props) => (
|
|
<Text
|
|
{...props}
|
|
variant={TextVariant.bodyMd}
|
|
className="snap-ui-markdown__text"
|
|
overflowWrap={OverflowWrap.BreakWord}
|
|
/>
|
|
);
|
|
|
|
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,
|
|
};
|