Sha256: 0d190a21be840e65eb5098e56537fe8dea8c8e1b0a88340934894060b277d8af

Contents?: true

Size: 1010 Bytes

Versions: 37

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

37 entries across 37 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.7.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.6.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.6.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.5.2 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.5.1 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-6.5.0 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha8 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha7 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha6 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha5 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha4 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha3 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
playbook_ui-7.0.1.pre.alpha2 app/pb_kits/playbook/pb_stat_value/_stat_value.jsx