Sha256: 549cbb4f13804d8f65ec688ad2103165989dadbc079e8a8e29e439711c24b98b

Contents?: true

Size: 1.27 KB

Versions: 8

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.js'

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

8 entries across 8 versions & 1 rubygems

Version Path
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_title/_title.jsx