react-price

0.6.1 • Public • Published

react-price

Commitizen friendly XO code style

NPM version Build Status Dependency Status DevDependency Status

React price component

Demo: vovanr.github.io/react-price

Install

npm install --save react-price

Usage

See: example

import Price from 'react-price';
 
const price = (
  <div>
    <div>
      <small>Old: </small>
      <Price cost={100} currency="$" type="old"/>
    </div>
    <div>
      <small>New: </small>
      <Price cost={91.55} currency=""/>
    </div>
    <div>
      <small>Sale: </small>
      <Price cost="7 793" currency=""/>
    </div>
  </div>
);
 
ReactDOM.render(price, document.getElementById('app'));

Api

Price.propTypes = {
  cost: PropTypes.any,
  className: PropTypes.string,
  currency: PropTypes.any,
  currencyFirst: PropTypes.bool,
  prefix: PropTypes.any,
  postfix: PropTypes.any,
  type: PropTypes.oneOf([
    'def',
    'old'
  ]),
};
Price.defaultProps = {
  cost: null,
  className: '',
  currency: null,
  currencyFirst: false,
  prefix: null,
  postfix: null,
  type: 'def'
};

License

MIT © Vladimir Rodkin

/react-price/

    Package Sidebar

    Install

    npm i react-price

    Weekly Downloads

    13

    Version

    0.6.1

    License

    MIT

    Unpacked Size

    10.8 kB

    Total Files

    6

    Last publish

    Collaborators

    • vovanr