<commit_before>/* eslint-disable no-mixed-operators */
import React, { Component } from 'react';
import { commonDefaultProps } from '../utils/commonProps';

const enquire = typeof window !== 'undefined' ? require('enquire.js') : null;

export default (Grid, { maxWidth, minPadding = 0, defaultColumns = 4 } = {}) =>
  class extends Component {
    static defaultProps = {
      gutterWidth: commonDefaultProps.gutterWidth
    };

    componentDidMount() {
      const { columnWidth, gutterWidth } = this.props;

      const breakpoints = [];
      const getWidth = i =>
        i * (columnWidth + gutterWidth) - gutterWidth + minPadding;

      for (
        let i = 1;
        getWidth(i) <= maxWidth + columnWidth + gutterWidth;
        i++
      ) {
        breakpoints.push(getWidth(i));
      }

      this.breakpoints = breakpoints
        .map((width, i, arr) =>
          [
            'screen',
            i > 0 && `(min-width: ${arr[i - 1]}px)`,
            i < arr.length - 1 && `(max-width: ${width}px)`
          ]
            .filter(Boolean)
            .join(' and ')
        )
        .map((breakpoint, i) => ({
          breakpoint,
          handler: () => this.setState({ columns: i })
        }));

      this.breakpoints.forEach(({ breakpoint, handler }) =>
        enquire.register(breakpoint, { match: handler })
      );
    }
<commit_msg>Fix makeResponsive issue<commit_after>/* eslint-disable no-mixed-operators */
import React, { Component } from 'react';
import { commonDefaultProps } from '../utils/commonProps';

const enquire = typeof window !== 'undefined' ? require('enquire.js') : null;

export default (Grid, { maxWidth, minPadding = 0, defaultColumns = 4 } = {}) =>
  class extends Component {
    static defaultProps = {
      gutterWidth: commonDefaultProps.gutterWidth
    };

    componentDidMount() {
      const { columnWidth, gutterWidth } = this.props;

      const breakpoints = [];
      const getWidth = i =>
        i * (columnWidth + gutterWidth) - gutterWidth + minPadding;

      for (
        let i = 2;
        getWidth(i) <= maxWidth + columnWidth + gutterWidth;
        i++
      ) {
        breakpoints.push(getWidth(i));
      }

      this.breakpoints = breakpoints
        .map((width, i, arr) =>
          [
            'screen',
            i > 0 && `(min-width: ${arr[i - 1]}px)`,
            i < arr.length - 1 && `(max-width: ${width}px)`
          ]
            .filter(Boolean)
            .join(' and ')
        )
        .map((breakpoint, i) => ({
          breakpoint,
          handler: () => this.setState({ columns: i + 1 })
        }));

      this.breakpoints.forEach(({ breakpoint, handler }) =>
        enquire.register(breakpoint, { match: handler })
      );
    }

{'fraction_non_alphanumeric': 0.14826958105646632, 'fraction_numerical': 0.004735883424408015, 'mean_word_length': 2.0477247502774696, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '5778823', 'n_tokens_mistral': 825, 'n_tokens_neox': 805, 'n_words': 185}