1
0
mirror of synced 2025-12-21 02:46:50 -05:00
Files
docs/components/ui/MarkdownContent/MarkdownContent.tsx
Kevin Heis 6eec270335 Add MarkdownContent to storybook (#21222)
* Add MarkdownContent to storybook

* Update MarkdownContent.tsx

* Update storybook.tsx
2021-09-01 15:10:47 +00:00

28 lines
628 B
TypeScript

import { ReactNode } from 'react'
import cx from 'classnames'
import styles from './MarkdownContent.module.scss'
export type MarkdownContentPropsT = {
children: string | ReactNode
className?: string
as?: keyof JSX.IntrinsicElements
}
export const MarkdownContent = ({
children,
as: Component = 'div',
className,
...restProps
}: MarkdownContentPropsT) => {
return (
<Component
{...restProps}
className={cx(styles.markdownBody, 'markdown-body', className)}
{...(typeof children === 'string'
? { dangerouslySetInnerHTML: { __html: children } }
: { children })}
/>
)
}