From c7b3f4a832974122af5de39f5b3aa8a416462586 Mon Sep 17 00:00:00 2001 From: Me Date: Tue, 20 Oct 2015 21:29:31 +0100 Subject: [PATCH] Somplify README code example. --- README.md | 88 +++++++------------------------------------------------ 1 file changed, 11 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 707f3e0..a51386d 100644 --- a/README.md +++ b/README.md @@ -44,16 +44,6 @@ const RaisedButton = require('material-ui/lib/raised-button'); const Form = React.createClass({ - childContextTypes: { - muiTheme: React.PropTypes.object - }, - - getChildContext(){ - return { - muiTheme: Styles.ThemeManager.getMuiTheme(Styles.LightRawTheme) - } - }, - getInitialState: function () { return { canSumbit: false @@ -61,30 +51,15 @@ const Form = React.createClass({ }, errorMessages: { - wordsError: "Please only use letters", - numericError: "Please provide a number", - urlError: "Please provide a valid URL" + wordsError: "Please only use letters" }, selectFieldItems: [ { payload: 'never', text: 'Never' }, { payload: 'nightly', text: 'Every Night' }, - { payload: 'weeknights', text: 'Weeknights' }, - { payload: 'weekends', text: 'Weekends' }, - { payload: 'weekly', text: 'Weekly' } + { payload: 'weeknights', text: 'Weeknights' } ], - styles: { - paper: { - width: 300, - margin: 20, - padding: 20 - }, - submit: { - marginTop: 32 - } - }, - enableButton: function () { this.setState({ canSubmit: true @@ -98,38 +73,20 @@ const Form = React.createClass({ }, submitForm: function (model) { + // Submit your validated form console.log("Model: ", model); - alert( - `Name: ${model.name}\n - Chucked: ${model.chuck}\n - URL: ${model.url}\n - Frequency: ${model.frequency}\n - Date: ${model.date}\n - Time: ${model.time}\n - Agree: ${model.agree}\n - Toggle: ${model.toggle}\n - Speed: ${model.shipSpeed}\n - `); - }, - - notifyFormError: function (model) { - console.error('Form error:', model); }, render: function () { - let styles = this.styles; - let { wordsError, numericError, urlError } = this.errorMessages; + let { wordsError } = this.errorMessages; return ( - + onValidSubmit={this.submitForm} > - - - - - + defaultChecked={true} /> + label="Toggle" /> + label="prepare for light speed" /> + label="light speed too slow" /> + disabled={true} /> - ); } });