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

export default class Slide extends Component {
  constructor (props) {
    super(props)
    this.state = {
      image: props.defaultImage || props.image,
      width: 0
    }

    this.load = this.load.bind(this)
  }

  componentDidMount () {
    if (this.props.autoLoad) this.load()
  }

  componentWillReceiveProps (nextProps) {
    this.setState({
      width: nextProps.width
    })
  }

  load () {
    const {image} = this.props
    if (this.state.image !== image) {
      const img = new Image()
      img.src = image
      img.onload = () => {
        this.setState({
          image
        })
      }
    }
  }

  render () {
    const {width, image, attributes, children, title} = this.props

    const style = {
      width,
      backgroundImage: `url(${this.state.image})`
    }

    const mainClass = classNames('rs-img', {
      'rs-loaded': this.state.image === image
    })

    return (
      <div
        className={mainClass}
        style={style}
        title={title}
        {...attributes}
      >{children}</div>
    )
  }
}

Slide.propTypes = {
  // additional attributes for the root node
  attributes: PropTypes.object,

  // should the component automatically lazy Load
  autoLoad: PropTypes.bool,

  // width of slide
  width: PropTypes.number,

  // url of the main image
  image: PropTypes.string.isRequired,

  // url of pre loaded image
  defaultImage: PropTypes.string,

  // title for the image
  // serves similar to alt attribute for image
  title: PropTypes.string,

  children: PropTypes.array
}

Slide.defaultProps = {
  attributes: {},
  autoLoad: false
}
<commit_msg>fix(title): added title in defaultProps<commit_after>import React, { Component, PropTypes } from 'react'
import classNames from 'classnames'

export default class Slide extends Component {
  constructor (props) {
    super(props)
    this.state = {
      image: props.defaultImage || props.image,
      width: 0
    }

    this.load = this.load.bind(this)
  }

  componentDidMount () {
    if (this.props.autoLoad) this.load()
  }

  componentWillReceiveProps (nextProps) {
    this.setState({
      width: nextProps.width
    })
  }

  load () {
    const {image} = this.props
    if (this.state.image !== image) {
      const img = new Image()
      img.src = image
      img.onload = () => {
        this.setState({
          image
        })
      }
    }
  }

  render () {
    const {width, image, attributes, children, title} = this.props

    const style = {
      width,
      backgroundImage: `url(${this.state.image})`
    }

    const mainClass = classNames('rs-img', {
      'rs-loaded': this.state.image === image
    })

    return (
      <div
        className={mainClass}
        style={style}
        title={title}
        {...attributes}
      >{children}</div>
    )
  }
}

Slide.propTypes = {
  // additional attributes for the root node
  attributes: PropTypes.object,

  // should the component automatically lazy Load
  autoLoad: PropTypes.bool,

  // width of slide
  width: PropTypes.number,

  // url of the main image
  image: PropTypes.string.isRequired,

  // url of pre loaded image
  defaultImage: PropTypes.string,

  // title for the image
  // serves similar to alt attribute for image
  title: PropTypes.string,

  children: PropTypes.array
}

Slide.defaultProps = {
  title: '',
  attributes: {},
  autoLoad: false
}

{'fraction_non_alphanumeric': 0.12186689714779603, 'fraction_numerical': 0.0005762028233938346, 'mean_word_length': 2.3676042677012608, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '190031', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1051, 'n_words': 271}