Sha256: 3a04f58d3f45cf4b1721b06d9217784a5bed294334438535c4b0c71365fed6ce

Contents?: true

Size: 842 Bytes

Versions: 11

Compression:

Stored size: 842 Bytes

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import {Title} from '../'

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

11 entries across 11 versions & 1 rubygems

Version Path
playbook_ui-3.1.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-3.0.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-3.0.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.9 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.8 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.7 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.6 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.5 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.4 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.3 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-2.9.2 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx