0.6.1 • Published 4 years ago

react-price v0.6.1

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

react-price

Commitizen friendly XO code style

NPM version Build Status Dependency Status DevDependency Status

React price component

Demo: vovanr.github.io/react-price

npm.io

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

0.6.1

4 years ago

0.6.0

6 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago