Last active
August 29, 2015 14:07
-
-
Save jkneal/b99c0befd3d7d70e2b81 to your computer and use it in GitHub Desktop.
Exploring how React components could be used to provide similar simple configuration (for lookups, inquiries, maintenance) for rapid screen creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @jsx React.DOM | |
*/ | |
var React = require('react'); | |
var Lookup = require('./lookup.jsx'); | |
var CourseLookup = React.createClass({ | |
getInitialState: function () { | |
return { | |
// this could be expanded out to include any config necessary | |
searchConfig : { | |
title: 'Course Lookup', | |
// could be left blank to use default rest provider like Peter was creating | |
serviceEndpoint: '/courseSearch', | |
criteria: [ | |
{ | |
name: 'courseTitle', | |
label: 'Title', | |
control: 'text' | |
}, | |
{ | |
name: 'courseSection', | |
label: 'Section', | |
control: 'text' | |
} | |
], | |
results: ['courseId', 'courseTitle', 'courseSection', 'courseDescription'] | |
} | |
}; | |
}, | |
// we could also bring this in with a mixin | |
render: function () { | |
return ( | |
<Lookup config={this.state.searchConfig}/> | |
); | |
} | |
}); | |
React.renderComponent(CourseLookup, document.getElementById('main')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment