// @flow
import PropTypes from 'prop-types';
import type { SpaceProps } from '../../../mixins/spacing';
import { spacePropTypes } from '../../../mixins/spacing';
import type { ContainerProps } from '../../../mixins/container';
import { containerPropTypes } from '../../../mixins/container';

type CTAProps =
  | {|
      onClick: (event: SyntheticEvent<HTMLButtonElement>) => void,
      type?: 'submit' | 'button',
    |}
  | {|
      href: string,
      target?: string,
    |};

export type SecondaryButtonProps = {
  ...SpaceProps,
  ...ContainerProps,
  ...CTAProps,
  disabled?: boolean,
};

export const secondaryButtonPropTypes = {
  ...spacePropTypes,
  ...containerPropTypes,
  onClick: PropTypes.func,
  type: PropTypes.oneOf(['submit', 'button']),
  href: PropTypes.string,
  target: PropTypes.string,
  disabled: PropTypes.bool,
};
