Created
February 1, 2021 14:47
-
-
Save jariz/99a917de387ca834fee22a060d8f55d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HtmlMapper html={html}> | |
{{ | |
p: Body, | |
h1: (props) => <Title variant="large" {...props} />, | |
h2: (props) => <Title variant="regular" {...props} />, | |
h3: (props) => <Title variant="small" {...props} />, | |
h4: (props) => <Title variant="micro" {...props} />, | |
h5: (props) => <Title variant="tiny" {...props} />, | |
a: ({ href, children, ...rest }) => | |
href?.startsWith("/") ? ( | |
// assume internal link | |
<Link to={href}>{children}</Link> | |
) : ( | |
<a href={href} {...rest}> | |
{children} | |
</a> | |
), | |
}} | |
</HtmlMapper> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment