Sha256: de6f01c7c73d82ceae5232b7f1b67f2e07447d9eed515387268dc784b0e45b93

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { spacing } from '../utilities/spacing.js'

type TitleProps = {
  aria?: object,
  children?: Array<React.ReactNode> | React.ReactNode,
  className?: String,
  dark?: Boolean,
  data?: object,
  id?: String,
  size?: 1 | 2 | 3 | 4,
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div",
  text?: String,
  variant?: null | "primary",
}

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

  const themeStyle = dark === true ? 'dark' : ''
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const classes = classnames(buildCss('pb_title_kit', size, themeStyle, variant), className, spacing(props))
  const Tag = `${tag}`

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

export default Title

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_title/_title.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_title/_title.jsx