import React from 'react';
import PropTypes from 'prop-types';
import Button from '../../Button';

const SlidePrevious = ({ currentSlide, goToSlide, ...props }) => {
  const onSlide = e => {
    e.preventDefault();
    goToSlide(currentSlide - 1);
  };
  return (
    <Button
      onClick={onSlide}
      disabled={currentSlide <= 0}
      {...props}
    > Previous </Button>
  );
};

SlidePrevious.propTypes = {
  currentSlide: PropTypes.number,
  goToSlide: PropTypes.func
};

SlidePrevious.defaultProps = {
  size: 'lg',
  variant: 'dash-lagoon',
  currentSlide: 0,
  goToSlide: null
};

export default SlidePrevious;
