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

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

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

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

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

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

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

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

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

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