// @flow
import React from 'react';
import { storiesOf } from '@storybook/react';
import { CurrencyFormatter } from './index';
import { withDocs } from '../../../.storybook/with-docs';
import docs from './CURRENCY-FORMATTER.mkd';

storiesOf('Primitives/CurrencyFormatter', module).add(
  'normal',
  withDocs(docs)(() => <CurrencyFormatter value={2489500.92} currency="CAD" />),
);

storiesOf('Primitives/CurrencyFormatter', module).add(
  'round to whole',
  withDocs(docs)(() => (
    <CurrencyFormatter
      value={2489500.92}
      currency="CAD"
      minimumFractionDigits={0}
      maximumFractionDigits={0}
    />
  )),
);
storiesOf('Primitives/CurrencyFormatter', module).add(
  'plus sign if positive',
  withDocs(docs)(() => (
    <CurrencyFormatter
      value={2489500.92}
      currency="CAD"
      minimumFractionDigits={0}
      maximumFractionDigits={0}
      showPlusSign
    />
  )),
);

storiesOf('Primitives/CurrencyFormatter', module).add(
  'plus sign but value is negative',
  withDocs(docs)(() => (
    <CurrencyFormatter
      value={-2489500.92}
      currency="CAD"
      minimumFractionDigits={0}
      maximumFractionDigits={0}
      showPlusSign
    />
  )),
);
