Sha256: b6f7e776fc33ec26146cd11e034c9dc97425fa4a7f31b7b2d83aeca2de7450c5

Contents?: true

Size: 1.28 KB

Versions: 53

Compression:

Stored size: 1.28 KB

Contents

class InlineRadioOptions extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      value: props.value
    }
  }

  onChange(value) {
    this.setState({
      value: value
    })
  }

  render() {
    const { name, label, options } = this.props;

    const optionElements = options.map((option, optionIndex) => {
      return (
        <InputRadio
          key={option.value}
          name={name}
          value={option.value}
          label={option.label}
          inline={true}
          isLast={optionIndex === (options.length - 1)}
          checked={option.value === this.state.value}
          onChange={this.onChange.bind(this)}
        />
      );
    });

    return (
      <CardSection wrappable={true}>
        <div className="wrappable__item wrappable__item--no-flex">
          <span>{label}</span>
        </div>
        <div className="wrappable__item">
          {optionElements}
        </div>
      </CardSection>
    );
  }

}

InlineRadioOptions.propTypes = {
  name: React.PropTypes.string,
  options: React.PropTypes.arrayOf(
    React.PropTypes.shape({
      label: React.PropTypes.string.isRequired,
      value: React.PropTypes.oneOfType([
        React.PropTypes.string,
        React.PropTypes.bool
      ]).isRequired
    })
  ).isRequired
};

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.0 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.1 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.2 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.3 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.4 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.5 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.6 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.7 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.8 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.9 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.10 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.9.11 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.10.0 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.10.1 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.10.2 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.10.3 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.10.4 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.10.5 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx
disco_app-0.11.0 app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx