Sha256: b99a33670d247aa92ebe21ceab1e12f84d9288700a0d08987266355ccda772f2

Contents?: true

Size: 649 Bytes

Versions: 8

Compression:

Stored size: 649 Bytes

Contents

<%= file_header %>class <%= component_name %> extends React.Component {
  render () {
<% if attributes.size > 0 -%>
    return (
      <div>
<% attributes.each do |attribute| -%>
        <div><%= attribute[:name].titleize %>: {this.props.<%= attribute[:name].camelize(:lower) %>}</div>
<% end -%>
      </div>
    );
<% else -%>
    return <div />;
<% end -%>
  }
}

<% if attributes.size > 0 -%>
<%= file_name.camelize %>.propTypes = {
<% attributes.each_with_index do |attribute, idx| -%>
  <%= attribute[:name].camelize(:lower) %>: <%= attribute[:type] %><% if (idx < attributes.length-1) %>,<% end %>
<% end -%>
};
<% end -%>
<%= file_footer %>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
react-rails-2.4.3 lib/generators/templates/component.es6.jsx
react-rails-2.4.2 lib/generators/templates/component.es6.jsx
react-rails-2.4.1 lib/generators/templates/component.es6.jsx
react-rails-2.4.0 lib/generators/templates/component.es6.jsx
react-rails-2.3.1 lib/generators/templates/component.es6.jsx
react-rails-2.3.0 lib/generators/templates/component.es6.jsx
react-rails-2.2.1 lib/generators/templates/component.es6.jsx
react-rails-2.2.0 lib/generators/templates/component.es6.jsx