// @flow
import React from 'react';
import { action } from '@storybook/addon-actions';
import { NextButton } from './next-button.component';
import type { NextButtonProps } from './next-button.proptypes';
import docs from './next-button.mdx';

export default {
  component: NextButton,
  title: 'Wizard Buttons/Next Button',
  parameters: {
    fileName: __filename,
    docs: {
      page: docs,
    },
  },
};

const logSubmit = (e) => {
  action('NEXT')();
  e.preventDefault();
};

const Form = ({ children }: { children: any }) => (
  <form onSubmit={logSubmit}>{children}</form>
);

const DEFAULT_PROPS: NextButtonProps = {
  /* Add default props here */
};

export const Default = () => (
  <Form>
    <NextButton {...DEFAULT_PROPS}>Press Enter</NextButton>
  </Form>
);

export const Disabled = () => (
  <Form>
    <NextButton {...DEFAULT_PROPS} disabled>
      Press Enter
    </NextButton>
  </Form>
);
