<commit_before>import React, { Component, PropTypes } from 'react';
import cx from 'classnames';

import Row from './Row';
import Col from './Col';

class Tabs extends Component {
  componentDidMount () {
    if (typeof $ !== 'undefined') {
      $(this.tabsEl).tabs();
    }
  }

  _onSelect (idx, e) {
    const { onChange } = this.props;

    if (onChange) onChange(idx, e);
  }

  render () {
    const {
      children,
      className,
      defaultValue
    } = this.props;

    return (
      <Row>
        <Col s={12}>
          <ul className={cx('tabs', className)} ref={(el) => (this._tabsEl = el)}>
            {
              React.Children.map(children, (child, idx) => {
                const {
                  active,
                  className,
                  disabled,
                  tabWidth,
                  title
                } = child.props;

                const classes = {
                  [`s${tabWidth}`]: tabWidth,
                  tab: true,
                  disabled,
                  col: true
                };

                return (
                  <li className={cx(classes, className)} key={idx}>
                    <a href={`#tab_${idx}`} className={active || defaultValue === idx ? 'active' : ''}
                      {...disabled ? {} : { onClick: this._onSelect.bind(this, idx) }}
                    >
                      { title }
                    </a>
                  </li>
                );
              })
            }
          </ul>
        </Col>
        {
          children.map((child, idx) =>
            <Col id={`tab_${idx}`} s={12} key={`tab_${idx}`}>
              { child.props.children }
            </Col>
          )
        }
      </Row>
    );
  }
}

Tabs.propTypes = {
  children: PropTypes.node.isRequired,
  className: PropTypes.string,
  defaultValue: PropTypes.string,
  onChange: PropTypes.func
};

export default Tabs;<commit_msg>Fixes wrong ID for initialization (#201)<commit_after>import React, { Component, PropTypes } from 'react';
import cx from 'classnames';

import Row from './Row';
import Col from './Col';

class Tabs extends Component {
  componentDidMount () {
    if (typeof $ !== 'undefined') {
      $(this._tabsEl).tabs();
    }
  }

  _onSelect (idx, e) {
    const { onChange } = this.props;

    if (onChange) onChange(idx, e);
  }

  render () {
    const {
      children,
      className,
      defaultValue
    } = this.props;

    return (
      <Row>
        <Col s={12}>
          <ul className={cx('tabs', className)} ref={(el) => (this._tabsEl = el)}>
            {
              React.Children.map(children, (child, idx) => {
                const {
                  active,
                  className,
                  disabled,
                  tabWidth,
                  title
                } = child.props;

                const classes = {
                  [`s${tabWidth}`]: tabWidth,
                  tab: true,
                  disabled,
                  col: true
                };

                return (
                  <li className={cx(classes, className)} key={idx}>
                    <a href={`#tab_${idx}`} className={active || defaultValue === idx ? 'active' : ''}
                      {...disabled ? {} : { onClick: this._onSelect.bind(this, idx) }}
                    >
                      { title }
                    </a>
                  </li>
                );
              })
            }
          </ul>
        </Col>
        {
          React.Children.map(children, (child, idx) =>
            <Col id={`tab_${idx}`} s={12} key={`tab${idx}`}>
              { child.props.children }
            </Col>
          )
        }
      </Row>
    );
  }
}

Tabs.propTypes = {
  children: PropTypes.node.isRequired,
  className: PropTypes.string,
  defaultValue: PropTypes.string,
  onChange: PropTypes.func
};

export default Tabs;
{'fraction_non_alphanumeric': 0.1413237924865832, 'fraction_numerical': 0.002811142346026067, 'mean_word_length': 1.257208765859285, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 33, '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': '7336577', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1077, 'n_words': 231}