// @flow
import React from 'react';
import { action } from '@storybook/addon-actions';
import { SecondaryButton } from './secondary-button.component';
import type { SecondaryButtonProps } from './secondary-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 './secondary-button.mdx';

export default {
  component: SecondaryButton,
  title: 'Components/Actions/Secondary Button',
  parameters: {
    docs: {
      page: docs,
    },
  },
};

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

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

export const AsLink = () => (
  <SecondaryButton {...DEFAULT_PROPS_HREF}>Go to Google</SecondaryButton>
);

export const AsButton = () => (
  <SecondaryButton {...DEFAULT_PROPS_CLICK}>Click me</SecondaryButton>
);

export const AsButtonLoading = () => (
  <SecondaryButton {...DEFAULT_PROPS_CLICK} isLoading>
    Click me
  </SecondaryButton>
);

export const AsButtonDisabled = () => (
  <SecondaryButton {...DEFAULT_PROPS_CLICK} disabled>
    Click me
  </SecondaryButton>
);

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

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