Sha256: 9823d6cb6ae04566b08fd71d528dfe2bc9a511bad8c6bc017b1e2a192e8eedb9
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import Body from '../pb_body/_body.jsx' import Caption from '../pb_caption/_caption.jsx' import Title from '../pb_title/_title.jsx' type CurrencyProps = { align?: 'left' | 'center' | 'right', className: String, currencySymbol: '$', label?: String, separator?: '.' | ',', size?: 'sm' | 'lg', value?: String, unit?: '00', } const kitCSS = ({align='left'}: CurrencyProps) => { let css = 'pb_currency_kit' css += `_${align}` return css } const bodyCSS = ({}: CurrencyProps) => { let css = '' return css } const symbolCSS = (currencySymbol) => { return classnames({ dollar_sign: currencySymbol === '$', }) } const sizes = { lg: 1, sm: 2, } const Currency = (props: CurrencyProps) => { const { currencySymbol='$', label='', separator='.', size='sm', units='00', value, } = props return ( <div className={kitCSS(props)}> <Caption>{label}</Caption> <div className='pb_currency_wrapper'> <Body className={symbolCSS(currencySymbol)}>{currencySymbol}</Body> <Title className='pb_currency_value' size={sizes[size]} > {`${value}${separator}`} </Title> <Body className='unit'>{units}</Body> </div> </div> ) } export default Currency
Version data entries
4 entries across 4 versions & 1 rubygems