Sha256: 25e8e4d36bf5c9798974690ec4cbd0da9b78bee7959b5d3316c57336f0c0e7c1

Contents?: true

Size: 1.58 KB

Versions: 105

Compression:

Stored size: 1.58 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { globalProps } from '../utilities/globalProps'

import Body from '../pb_body/_body'
import StatChange from '../pb_stat_change/_stat_change'
import StatValue from '../pb_stat_value/_stat_value'

type DashboardValueProps = {
  align?: 'left' | 'center' | 'right',
  aria?: object,
  className?: string,
  data?: object,
  id?: string,
  statChange?: {
    change?: string,
    value?: string | Number
  },
  statLabel?: string,
  statValue?: {
    unit?: string,
    value?: string | Number
  }
}

const DashboardValue = (props: DashboardValueProps) => {
  const {
    align = 'left',
    aria = {},
    className,
    data = {},
    id,
    statChange = {},
    statLabel,
    statValue = {},
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const classes = classnames(
    buildCss('pb_dashboard_value_kit', align),
    globalProps(props),
    className
  )

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={classes}
        id={id}
    >
      <If condition={statLabel}>
        <Body color="light">{statLabel}</Body>
      </If>
      <If condition={statValue}>
        <StatValue
            unit={statValue.unit}
            value={statValue.value}
        />
      </If>
      <If condition={statChange}>
        <StatChange
            change={statChange.change}
            value={statChange.value}
        />
      </If>
    </div>
  )
}

export default DashboardValue

Version data entries

105 entries across 105 versions & 1 rubygems

Version Path
playbook_ui-12.3.1.pre.alpha.phone1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-12.3.1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-12.3.0.pre.alpha.patchtest1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-12.3.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-12.2.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-12.1.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-12.0.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.20.0.pre.alpha.passthrough1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.20.0.pre.alpha.railsdialog1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.20.0.pre.alpha.focus1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.20.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.19.0.pre.alpha.map1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.19.0.pre.alpha.pagpassthrough1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.19.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.18.0.pre.alpha.pagutility1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.19.0.pre.typeahead1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.18.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.17.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.15.0.pre.alpha.dependencies1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.16.0.pre.alpha.paginationrails1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx