Sha256: 4978be21099838ed1faaad3f414230b98559ea41e953247874e21c0e170114f2

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'

import {
  Body,
  Caption,
  Title,
} from '../'

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

11 entries across 11 versions & 1 rubygems

Version Path
playbook_ui-3.1.0 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-3.0.1 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-3.0.0 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.9 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.8 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.7 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.6 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.5 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.4 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.3 app/pb_kits/playbook/pb_currency/_currency.jsx
playbook_ui-2.9.2 app/pb_kits/playbook/pb_currency/_currency.jsx