// @flow
import Color from 'color';
import type { ThemeProps } from '../../../types';
import type { StackeeProps } from '../../../mixins/stackee';
import type { ButtonProps } from './button.proptypes';
import { getPaletteColor } from '../../../mixins/branding';

export const getHeight = ({ size = 'md' }: ButtonProps) => {
  switch (size) {
    case 'sm':
      return '40px';
    case 'md':
      return '48px';
    default:
      return '48px';
  }
};

export const getBorderRadius = ({ theme }: ThemeProps) =>
  theme.buttonBorderRadius;

export const getMinWidth = ({ shrink }: StackeeProps) =>
  shrink == null ? '160px' : undefined;

export const getHoverBackgroundColor = (props: ThemeProps) =>
  Color(getPaletteColor('brand-primary-fg')(props)).darken(0.2);
