Sha256: 5cc1a544394cd3b7448620cbef52d5e2a05deb5933fe42689a47953eb78b2023

Contents?: true

Size: 1.27 KB

Versions: 15

Compression:

Stored size: 1.27 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 TitleProps = {
  aria?: object,
  children?: array<React.ReactNode> | React.ReactNode,
  className?: string,
  color?: "default" | "light" | "lighter" | "success" | "error" | "link",
  data?: object,
  id?: string,
  size?: 1 | 2 | 3 | 4,
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
  text?: string,
  variant?: null | "link",
}

const Title = (props: TitleProps) => {
  if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
  const {
    aria = {},
    children,
    className,
    color,
    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, color),
    globalProps(props),
    className,
  )
  const Tag = `${tag}`

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

export default Title

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
playbook_ui-10.26.0.pre.alpha.sticky1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.26.0.pre.alpha3 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.25.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.25.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.24.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.23.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.22.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.22.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.0 app/pb_kits/playbook/pb_title/_title.jsx