import React from 'react';
import { ButtonProps } from '../utils/types';
import {
  TileButton,
  TileWhiteButton,
  TileButtonSuccess,
  MagnifierImg,
  CheckImg,
} from './style';

const ButtonKDS = ({
  text,
  type = '',
  isIcon = false,
  setIsZoomIn,
  callOrderApi,
  isZoomIn,
}: ButtonProps): JSX.Element => {
  return type === 'white' ? (
    <TileWhiteButton onClick={() => setIsZoomIn(!isZoomIn)}>
      {isIcon && <MagnifierImg data-testid="magnifier-icon" />}
      {text}
    </TileWhiteButton>
  ) : type === 'large' ? (
    <TileButtonSuccess onClick={callOrderApi}>
      {isIcon && <CheckImg />}
      {text}
    </TileButtonSuccess>
  ) : (
    <TileButton onClick={callOrderApi}>
      {isIcon && <CheckImg />}
      {text}
    </TileButton>
  );
};

export default ButtonKDS;
