mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-28 20:25:29 +08:00
35 lines
765 B
TypeScript
35 lines
765 B
TypeScript
import React from 'react'
|
|
import useTheme from '../styles/use-theme'
|
|
import withDefaults from '../utils/with-defaults'
|
|
|
|
interface Props {
|
|
className?: string
|
|
}
|
|
|
|
const defaultProps = {
|
|
className: ''
|
|
}
|
|
|
|
export type FieldsetSubtitleProps = Props & typeof defaultProps & React.HTMLAttributes<HTMLHeadingElement>
|
|
|
|
const FieldsetSubtitle: React.FC<FieldsetSubtitleProps> = React.memo(({
|
|
className, children, ...props
|
|
}) => {
|
|
const theme = useTheme()
|
|
|
|
return (
|
|
<>
|
|
<p className={className} {...props}>{children}</p>
|
|
<style jsx>{`
|
|
p {
|
|
font-size: .875rem;
|
|
line-height: 1.6;
|
|
margin: ${theme.layout.gapHalf} 0;
|
|
}
|
|
`}</style>
|
|
</>
|
|
)
|
|
})
|
|
|
|
export default withDefaults(FieldsetSubtitle, defaultProps)
|