Sha256: 201792c512e625d7cfc6a2d39b261fa4f6d80380f464d95becf62bd32a98ebce
Contents?: true
Size: 1.47 KB
Versions: 15
Compression:
Stored size: 1.47 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props' import { deprecatedProps, globalProps } from '../utilities/globalProps' type CaptionProps = { aria?: object, children: array<React.ReactNode> | React.ReactNode, className?: string, color?: "default" | "light" | "lighter" | "success" | "error" | "link", data?: object, id?: string, size?: "xs" | "sm" | "md" | "lg" | "xl", tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "caption", text?: string, variant?: null | "link", }; const Caption = (props: CaptionProps) => { 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
15 entries across 15 versions & 1 rubygems