Sha256: 51878d37de0fb6691e32fcd96c713fc6009af270bba384eebbcab127563efbf2

Contents?: true

Size: 1.06 KB

Versions: 197

Compression:

Stored size: 1.06 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),
    globalProps(props),
    className
  )
  const Tag = `${tag}`

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

export default Title

Version data entries

197 entries across 197 versions & 1 rubygems

Version Path
playbook_ui-10.18.2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.18.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.18.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.17.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.16.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.15.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.15.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.14.1.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.14.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.13.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.13.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.12.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.11.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.10.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.9.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx