Sha256: 96591426a9e6ffcc2557d304b8f60f8f567bf89d51d2ca9a8d6868cf18c1fa62

Contents?: true

Size: 1.05 KB

Versions: 24

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 | "link",
}

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

24 entries across 24 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.7.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.6.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.6.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.5.2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.5.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.5.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.4.2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.0.pre.alpha9 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.0.pre.alpha8 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.0.pre.alpha7 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.4.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.0.pre.alpha6 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-7.0.0.pre.alpha5 app/pb_kits/playbook/pb_title/_title.jsx