Sha256: d24fdc2b5534ffae47b09a05f78bfbd947e54b2e11da351b0cfadfabca9e97ae

Contents?: true

Size: 932 Bytes

Versions: 38

Compression:

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

export default StatValue

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.16.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.15.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.14.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.13.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.13.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.12.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.11.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.10.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.9.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.8.2 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.8.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.7.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.7.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-4.6.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx