Sha256: 53dfd7c7cedb6fdac9601405ddcdda472174510b5142298d3648f041d79ffce8

Contents?: true

Size: 1.42 KB

Versions: 6

Compression:

Stored size: 1.42 KB

Contents

Rev.registerComponent('Col', class extends React.Component {

  static get boolProps() {
    return this._boolProps = this._boolProps || [
      'end',
      'smallCentered',
      'mediumCentered',
      'largeCentered',
      'smallUncentered',
      'mediumUncentered',
      'largeUncentered',
    ]
  }

  static get numberProps() {
    return this._numberProps = this._numberProps || [
      'small',
      'smallOffset',
      'smallPush',
      'smallPull',
      'medium',
      'mediumOffset',
      'mediumPush',
      'mediumPull',
      'large',
      'largeOffset',
      'largePush',
      'largePull',
    ]
  }

  static get propTypes() {
    let propTypes = {}
    this.boolProps.forEach((x) => propTypes[x] = React.PropTypes.bool)
    this.numberProps.forEach((x) => propTypes[x] = React.PropTypes.number)
    return propTypes
  }

  get className() {
    let classNamesObject = {
      'RevCol': true,
      'columns': true,
    }

    this.constructor.boolProps.forEach((x) => {
      if(this.props[x]) {
        classNamesObject[_.str.dasherize(x)] = true
      }
    })

    this.constructor.numberProps.forEach((x) => {
      let count = this.props[x]
      if(count != null) {
        classNamesObject[`${_.str.dasherize(x)}-${count}`] = true
      }
    })

    return this.classAdd(classNamesObject)
  }

  render() {
    return <div {...this.props} className={this.className}>
      {this.props.children}
    </div>
  }

})

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
revelry_core-0.1.12.6 app/assets/javascripts/revelry/ui/grid/Col.es6
revelry_core-0.1.12.5 app/assets/javascripts/revelry/ui/grid/Col.es6
revelry_core-0.1.12.4 app/assets/javascripts/revelry/ui/grid/Col.es6
revelry_core-0.1.12.3 app/assets/javascripts/revelry/ui/grid/Col.es6
revelry_core-0.1.12.2 app/assets/javascripts/revelry/ui/grid/Col.es6
revelry_core-0.1.12.0 app/assets/javascripts/revelry/ui/grid/Col.es6