Sha256: 1a6823798fc80f1353849fc5f4574168c2c9e8e1d8cc7db0175856f8905d0044

Contents?: true

Size: 1.22 KB

Versions: 44

Compression:

Stored size: 1.22 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'

import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'

import { Body, Title } from '../'
import { spacing } from '../utilities/spacing.js'

type TitleCountProps = {
  align: "center" | "left" | "right",
  aria?: object,
  className?: String,
  count?: Numeric,
  data?: object,
  id?: String,
  title?: String,
  size?: "lg" | "sm",
};

const TitleCount = (props: TitleCountProps) => {
  const {
    align = 'left',
    aria = {},
    className,
    data = {},
    count,
    id,
    title,
    size = 'sm' } = props
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)

  const css = classnames(buildCss('pb_title_count_kit', align, size), className, spacing(props))

  const formatCount = count.toLocaleString()

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={css}
        id={id}
    >
      <Title
          className={title !== undefined ? 'pb_title_count_text' : ''}
          size={size === 'lg' ? 3 : 4}
          text={title}
      />

      <Body color="light">
        <If condition={count}>{formatCount}</If>
      </Body>

    </div>
  )
}

export default TitleCount

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_title_count/_title_count.jsx
playbook_ui-5.2.0.pre.alpha9 app/pb_kits/playbook/pb_title_count/_title_count.jsx