Sha256: 4d9d609b900b2b40c0f309296f23972d1a7f69360f165e8b2089bbed0776cb40

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import Title from '../pb_title/_title.jsx'

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 id={id} className={classnames('pb_stat_value_kit', className)}>
      <div className="pb_stat_value_wrapper">
        {displayValue(value)}
        &nbsp;
        {displayUnit(unit)}
      </div>
    </div>
  )
}

export default StatValue

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-2.9.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.8.9 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx