import React from 'react';

import {
  NormalButton,
  DisableButton,
} from './styled';

export type Props = {
  appearance?: 'default' | 'primary' | 'primary-hollow' | 'default-hollow' | 'link' | 'danger-link';
  id?: string;
  isDisabled?: boolean;
  onClick?: () => void;
  onBlur?: () => void;
  shouldFitContainer?: boolean;
  align?: 'left' | 'center' | 'right';
  children: React.ReactNode;
  style?: {};
};

const Button: React.FunctionComponent<Props> = ({
  children,
  isDisabled,
  ...rest
}: Props): React.ReactElement => (
  isDisabled ? (
    <DisableButton>
      {children}
    </DisableButton>
  ) : (
    <NormalButton
      {...rest}
    >
      {children}
    </NormalButton>
  )
);

Button.defaultProps = {
  appearance: 'default',
  align: 'center',
  shouldFitContainer: false,
  isDisabled: false,
};

export default Button;
