Sha256: 5f88f12ed25a90fec8fe231e8da9cc67d7632af74135efa2427a3748041a172c
Contents?: true
Size: 1.15 KB
Versions: 44
Compression:
Stored size: 1.15 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import { buildCss } from '../utilities/props' import { Body, Icon } from '../' import { spacing } from '../utilities/spacing.js' const statusMap = { increase: 'positive', decrease: 'negative', } const iconMap = { increase: 'arrow-up', decrease: 'arrow-down', } type StatChangeProps = { change?: "increase" | "decrease" | "neutral", className?: String, id?: String, value?: String | Number, } const StatChange = (props: StatChangeProps) => { const { change = 'neutral', className, id, value } = props const status = statusMap[change] || 'neutral' const icon = iconMap[change] return ( <If condition={value}> <div className={classnames( className, buildCss('pb_stat_change_kit', status), spacing(props) )} id={id} > <Body status={status}> <If condition={icon}> <Icon fixed_width icon={icon} /> {' '} </If> {`${value}%`} </Body> </div> </If> ) } export default StatChange
Version data entries
44 entries across 44 versions & 1 rubygems