slate/components/core/ProcessedText.js

22 lines
507 B
JavaScript
Raw Normal View History

2021-07-07 23:50:57 +03:00
import { H1, H2, H3, H4, P1, UL, OL, LI, A } from "~/components/system/components/Typography";
import { Markdown } from "~/components/system/components/Markdown";
const ProcessedText = ({ text, dark }) => {
const remarkReactComponents = {
2021-07-07 23:50:57 +03:00
h1: P1,
h2: P1,
h3: P1,
h4: P1,
h5: P1,
h6: P1,
ol: OL,
ul: UL,
li: LI,
2021-07-07 23:50:57 +03:00
a: (props) => <A dark={dark} {...props} />,
};
return <Markdown md={text} options={{ remarkReactComponents }} />;
};
export default ProcessedText;