Sha256: ed368a62678f27dd7ebba31b0e6598085ccc09fedad1246f2777f9c4922b37c9

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 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 TitleProps = {
  aria?: object,
  children?: Array<React.ReactNode> | React.ReactNode,
  className?: String,
  data?: object,
  id?: String,
  size?: 1 | 2 | 3 | 4,
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
  text?: String,
  variant?: null | "primary",
}

const Title = (props: TitleProps) => {
  const {
    aria = {},
    children,
    className,
    data = {},
    id,
    size = 3,
    tag = 'h3',
    text,
    variant = null,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const classes = classnames(buildCss('pb_title_kit', size, variant), className, globalProps(props))
  const Tag = `${tag}`

  return (
    <Tag
        {...ariaProps}
        {...dataProps}
        className={classes}
        id={id}
    >
      {text || children}
    </Tag>
  )
}

export default Title

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.1.0.pre.alpha3 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.1.0 app/pb_kits/playbook/pb_title/_title.jsx