1
0
mirror of synced 2025-12-23 21:07:12 -05:00

Create a lead component (#21311)

* Create a lead component

* Update to remove markdown-body from Lead, copy over <code> styles

* ...so I can read the test output

* Update Lead.tsx

* Update Lead.tsx
This commit is contained in:
Kevin Heis
2021-09-16 12:02:56 -07:00
committed by GitHub
parent e2fe15e648
commit 504155926d
11 changed files with 60 additions and 19 deletions

View File

@@ -0,0 +1,21 @@
import { ReactNode } from 'react'
import cx from 'classnames'
import styles from './Lead.module.scss'
export type LeadPropsT = {
children: string | ReactNode
className?: string
as?: keyof JSX.IntrinsicElements
}
export function Lead({ children, className, as: Component = 'div', ...restProps }: LeadPropsT) {
return (
<Component
className={cx('f2 color-text-secondary mb-3', styles.container, className)}
{...restProps}
{...(typeof children === 'string'
? { dangerouslySetInnerHTML: { __html: children } }
: { children })}
/>
)
}