Sha256: 685cf1ee86b60a39ae4e982d29210c7a1212f6cbdfecc96af74789c3971da5e7
Contents?: true
Size: 1.49 KB
Versions: 302
Compression:
Stored size: 1.49 KB
Contents
import React from 'react' import classnames from 'classnames' import { buildCss } from '../utilities/props' import { globalProps } from '../utilities/globalProps' import Body from '../pb_body/_body' import Icon from '../pb_icon/_icon' const statusMap: {neutral: 'neutral', decrease: 'negative' ,increase: 'positive'} = { increase: 'positive', decrease: 'negative', neutral: 'neutral', } const iconMap = { increase: 'arrow-up', decrease: 'arrow-down', } type StatChangeProps = { change?: 'increase' | 'decrease' | 'neutral', className?: string, icon?: string, id?: string, value?: string | number, } const StatChange = (props: StatChangeProps): React.ReactElement => { const { change = 'neutral', className, icon, id, value } = props const status = statusMap[change as keyof typeof statusMap] let returnedIcon = iconMap[change as keyof typeof iconMap] if (icon) { returnedIcon = icon } return ( <> {value && <div className={classnames( buildCss('pb_stat_change_kit', status), globalProps(props), className )} id={id} > <Body status={status}> {returnedIcon && <> <Icon fixed_width icon={returnedIcon} /> {' '} </> } {`${value}%`} </Body> </div> } </> ) } export default StatChange
Version data entries
302 entries across 302 versions & 1 rubygems