// @flow
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import { CurrencyFormatter } from './index';
import { configDocs } from '../../../.storybook/config-docs';
import docs from './CURRENCY-FORMATTER.mkd';

storiesOf('Primitives/CurrencyFormatter', module)
  .addDecorator(withInfo(configDocs(docs, CurrencyFormatter)))
  .add('normal', () => <CurrencyFormatter value={2489500.92} currency="CAD" />)
  .add('round to whole', () => (
    <CurrencyFormatter
      value={2489500.92}
      currency="CAD"
      minimumFractionDigits={0}
      maximumFractionDigits={0}
    />
  ))
  .add('plus sign if positive', () => (
    <CurrencyFormatter
      value={2489500.92}
      currency="CAD"
      minimumFractionDigits={0}
      maximumFractionDigits={0}
      showPlusSign
    />
  ))
  .add('plus sign but value is negative', () => (
    <CurrencyFormatter
      value={-2489500.92}
      currency="CAD"
      minimumFractionDigits={0}
      maximumFractionDigits={0}
      showPlusSign
    />
  ));
