Sha256: e386aa342d221b98d2117ca0db627ccb4a945982d3ad98f4fa76e9be64939a27
Contents?: true
Size: 1.54 KB
Versions: 298
Compression:
Stored size: 1.54 KB
Contents
import React from 'react' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props' import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps' type CaptionProps = { aria?: {[key: string]: string}, children?: React.ReactChild[] | React.ReactChild, className?: string, color?: "default" | "light" | "lighter" | "success" | "error" | "link", data?: {[key: string]: string}, id?: string, size?: "xs" | "sm" | "md" | "lg" | "xl", tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "caption", text?: string, variant?: null | "link", } & GlobalProps; const Caption = (props: CaptionProps): React.ReactElement => { if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead const { aria = {}, children, className, color, data = {}, id, size = 'md', tag = 'div', text, variant = null, } = props const tagOptions = [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'div', 'caption', ] const Tag = tagOptions.includes(tag) ? tag : 'div' const ariaProps = buildAriaProps(aria) const dataProps = buildDataProps(data) const css = classnames( buildCss('pb_caption_kit', size, variant, color), globalProps(props), className, ) return ( <Tag {...ariaProps} {...dataProps} className={css} id={id} > {text || children} </Tag> ) } export default Caption
Version data entries
298 entries across 298 versions & 1 rubygems