2022-12-13 15:37:20 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import ReactMarkdown from 'react-markdown';
|
|
|
|
import { TYPOGRAPHY } from '../../../../helpers/constants/design-system';
|
|
|
|
import Typography from '../../../ui/typography/typography';
|
|
|
|
|
2022-12-20 11:44:49 +01:00
|
|
|
const Paragraph = (props) => (
|
|
|
|
<Typography
|
|
|
|
{...props}
|
|
|
|
variant={TYPOGRAPHY.H6}
|
|
|
|
className="snap-ui-markdown__text"
|
|
|
|
/>
|
|
|
|
);
|
2022-12-13 15:37:20 +01:00
|
|
|
|
|
|
|
export const SnapUIMarkdown = ({ children }) => {
|
|
|
|
return (
|
|
|
|
<ReactMarkdown
|
|
|
|
allowedElements={['p', 'strong', 'em']}
|
|
|
|
components={{ p: Paragraph }}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</ReactMarkdown>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
SnapUIMarkdown.propTypes = {
|
|
|
|
children: PropTypes.string,
|
|
|
|
};
|