Sha256: 4716e0928421eea48ed5a7c2faac1833da8d70d696aa0d9a18ce32c8d4070641
Contents?: true
Size: 1.22 KB
Versions: 105
Compression:
Stored size: 1.22 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props' import { globalProps } from '../utilities/globalProps.js' type CaptionProps = { aria?: object, className?: string, children: array<React.ReactNode> | React.ReactNode, 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) => { const { aria = {}, className, children, 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), globalProps(props), className ) return ( <Tag {...ariaProps} {...dataProps} className={css} id={id} > {text || children} </Tag> ) } export default Caption
Version data entries
105 entries across 105 versions & 1 rubygems