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-11.16.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.16.0.pre.alpha.reactupgrade1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.15.0.pre.alpha.table1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.16.0.pre.alpha.pagination.rails1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.15.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.14.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.13.0.pre.alpha.fontawesome1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.13.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.12.1.pre.alpha.charts1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.12.1.pre.alpha.passphrase1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.12.1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.13.0.pre.alpha.fileupload1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.12.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.11.0.pre.alpha.paginate2 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.11.0.pre.alpha.dialog2 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.11.0.pre.alpha.paginate1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.11.0.pre.alpha.renderer1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.11.0.pre.alpha.dialog1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.11.0 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
playbook_ui-11.10.0.pre.alpha.pre.bold1 app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx