// @flow
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from './button.component';
import type { ButtonProps } from './button.proptypes';
import { MarginChecker } from '../../../mixins/spacing/story-support/margin-checker';
import { PaddingChecker } from '../../../mixins/spacing/story-support/padding-checker';
import { StackeeChecker } from '../../../mixins/stackee/story-support/stackee-checker';

import docs from './button.mdx';

export default {
  component: Button,
  title: 'Buttons/Primary',
  parameters: {
    docs: {
      page: docs,
    },
  },
};

const DEFAULT_PROPS_CLICK: ButtonProps = {
  onClick: action('clicked'),
};

const DEFAULT_PROPS_HREF: ButtonProps = {
  href: 'https://google.com',
};

export const Sm = () => (
  <Button {...DEFAULT_PROPS_CLICK} size="sm">
    Click me
  </Button>
);
export const Md = () => (
  <Button {...DEFAULT_PROPS_CLICK} size="md">
    Click me
  </Button>
);

export const Disabled = () => (
  <Button {...DEFAULT_PROPS_HREF} size="md" disabled>
    Go to Google
  </Button>
);

export const AsLink = () => (
  <Button {...DEFAULT_PROPS_HREF} size="md">
    Go to Google
  </Button>
);

export const MixinsSpacing = () => (
  <>
    <MarginChecker Component={Button} {...DEFAULT_PROPS_CLICK}>
      Click me
    </MarginChecker>
    <PaddingChecker Component={Button} {...DEFAULT_PROPS_CLICK}>
      Click me
    </PaddingChecker>
  </>
);

export const MixinsStackee = () => (
  <StackeeChecker Component={Button} {...DEFAULT_PROPS_CLICK}>
    Click me
  </StackeeChecker>
);
