Skip to content

Instantly share code, notes, and snippets.

@AndrewIngram
Created June 17, 2014 11:41
Show Gist options
  • Save AndrewIngram/1055c05e8525501a4d45 to your computer and use it in GitHub Desktop.
Save AndrewIngram/1055c05e8525501a4d45 to your computer and use it in GitHub Desktop.
var buildSchema = function(state) {
var cityOptions = [
{value: 'LAX', name: 'Los Angeles'},
{value: 'LON', name: 'London'},
{value: 'NYC', name: 'New York'},
{value: 'PAR', name: 'Paris'},
{value: 'N/A', name: 'Other'}
];
var featuresOptions = state.amenities;
return (
<Schema>
<CityField options={cityOptions} />
<Property
name="features"
label="And finally, what makes your home special?"
input={<RadioButtonGroup options={featuresOptions} />}
required />
</Schema>
);
};
var Questionnaire = React.createClass({
mixins: [FluxMixin, StoreWatchMixin("QuestionnaireStore")],
getStateFromFlux: function() {
return this.getFlux().store('QuestionnaireStore').getState();
},
render: function() {
return <Form schema={buildSchema(this.state)} />;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment