<commit_before>'use strict';

import React from 'react';
import classnames from 'classnames';

export var PrevArrow = React.createClass({

  clickHandler: function (options, e) {
    if (e) { e.preventDefault(); }
    this.props.clickHandler(options, e);
  },
  render: function () {
    var prevClasses = {'slick-arrow': true, 'slick-prev': true};
    var prevHandler = this.clickHandler.bind(this, {message: 'previous'});

    if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
      prevClasses['slick-disabled'] = true;
      prevHandler = null;
    }

    var prevArrowProps = {
      key: '0',
      'data-role': 'none',
      className: classnames(prevClasses),
      style: {display: 'block'},
      onClick: prevHandler
    };
    var prevArrow;

    if (this.props.prevArrow) {
      prevArrow = React.cloneElement(this.props.prevArrow, prevArrowProps);
    } else {
      prevArrow = <button key='0' type='button' {...prevArrowProps}> Previous</button>;
    }

    return prevArrow;
  }
});


export var NextArrow = React.createClass({
  clickHandler: function (options, e) {
    if (e) { e.preventDefault(); }
    this.props.clickHandler(options, e);
  },
  render: function () {
    var nextClasses = {'slick-arrow': true, 'slick-next': true};
    var nextHandler = this.clickHandler.bind(this, {message: 'next'});

    if (!this.props.infinite) {
      if (this.props.centerMode && this.props.currentSlide >= (this.props.slideCount - 1)) {
        nextClasses['slick-disabled'] = true;
        nextHandler = null;
      } else {
        if (this.props.currentSlide >= (this.props.slideCount - this.props.slidesToShow)) {
          nextClasses['slick-disabled'] = true;
          nextHandler = null;
        }
      }

      if (this.props.slideCount <= this.props.slidesToShow) {
        nextClasses['slick-disabled'] = true;
        nextHandler = null;
      }
    }


    var nextArrowProps = {
      key: '1',
      'data-role': 'none',
      className: classnames(nextClasses),
      style: {display: 'block'},
      onClick: nextHandler
    };

    var nextArrow;

    if (this.props.nextArrow) {
      nextArrow = React.cloneElement(this.props.nextArrow, nextArrowProps);
    } else {
      nextArrow = <button key='1' type='button' {...nextArrowProps}> Next</button>;
    }

    return nextArrow;
  }
});
<commit_msg>Fixing next button disable state<commit_after>'use strict';

import React from 'react';
import classnames from 'classnames';

export var PrevArrow = React.createClass({

  clickHandler: function (options, e) {
    if (e) { e.preventDefault(); }
    this.props.clickHandler(options, e);
  },
  render: function () {
    var prevClasses = {'slick-arrow': true, 'slick-prev': true};
    var prevHandler = this.clickHandler.bind(this, {message: 'previous'});

    if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
      prevClasses['slick-disabled'] = true;
      prevHandler = null;
    }

    var prevArrowProps = {
      key: '0',
      'data-role': 'none',
      className: classnames(prevClasses),
      style: {display: 'block'},
      onClick: prevHandler
    };
    var prevArrow;

    if (this.props.prevArrow) {
      prevArrow = React.cloneElement(this.props.prevArrow, prevArrowProps);
    } else {
      prevArrow = <button key='0' type='button' {...prevArrowProps}> Previous</button>;
    }

    return prevArrow;
  }
});


export var NextArrow = React.createClass({
  clickHandler: function (options, e) {
    if (e) { e.preventDefault(); }
    this.props.clickHandler(options, e);
  },
  render: function () {
    var nextClasses = {'slick-arrow': true, 'slick-next': true};
    var nextHandler = this.clickHandler.bind(this, {message: 'next'});

    if (!this.props.infinite) {
      if (this.props.centerMode) {
        // check if current slide is last slide
        if (this.props.currentSlide >= (this.props.slideCount - 1)) {
          nextClasses['slick-disabled'] = true;
          nextHandler = null;
        }
      } else {
        // check if all slides are shown in slider
        if (this.props.slideCount <= this.props.slidesToShow ||
          this.props.currentSlide >= (this.props.slideCount - this.props.slidesToShow)) {
          nextClasses['slick-disabled'] = true;
          nextHandler = null;
        }
      }
    }


    var nextArrowProps = {
      key: '1',
      'data-role': 'none',
      className: classnames(nextClasses),
      style: {display: 'block'},
      onClick: nextHandler
    };

    var nextArrow;

    if (this.props.nextArrow) {
      nextArrow = React.cloneElement(this.props.nextArrow, nextArrowProps);
    } else {
      nextArrow = <button key='1' type='button' {...nextArrowProps}> Next</button>;
    }

    return nextArrow;
  }
});

{'fraction_non_alphanumeric': 0.14902363823227133, 'fraction_numerical': 0.0024665981500513875, 'mean_word_length': 2.7838258164852254, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7170295', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1540, 'n_words': 329}