Sha256: a90f5b8e711d2021b977d346deb6dab79d9d944bdb3c236c3646f1f887bfacd2

Contents?: true

Size: 1010 Bytes

Versions: 7

Compression:

Stored size: 1010 Bytes

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { Title } from '../'
import { globalProps } from '../utilities/globalProps.js'

type StatValueProps = {
  className?: String,
  id?: String,
  unit?: String,
  value: String | Number
}

const StatValue = (props: StatValueProps) => {
  const {
    className,
    id,
    unit,
    value = 0,
  } = props

  const displayValue = function(value) {
    if (value) {
      return (
        <Title
            size={1}
            text={value}
        />
      )
    }
  }

  const displayUnit = function(unit) {
    if (unit) {
      return (
        <Title
            size={3}
            text={unit}
        />
      )
    }
  }

  return (
    <div
        className={classnames('pb_stat_value_kit', className, globalProps(props))}
        id={id}
    >
      <div className="pb_stat_value_wrapper">
        {displayValue(value)}
        &nbsp;
        {displayUnit(unit)}
      </div>
    </div>
  )
}

export default StatValue

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.1.0.pre.alpha3 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.1.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.0.1.pre.alpha6 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx