From 536c21c87536adba1fc3c397576ff47c43c54229 Mon Sep 17 00:00:00 2001 From: komcal Date: Sun, 2 Oct 2016 21:44:53 +0700 Subject: [PATCH] add more input type --- src/components/SurveyForm/Inputs.js | 51 +++++++++++++++++++ src/components/SurveyForm/SurveyForm.js | 38 +++++++------- src/components/SurveyForm/surveyValidation.js | 4 +- src/containers/Survey/Survey.js | 4 +- 4 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 src/components/SurveyForm/Inputs.js diff --git a/src/components/SurveyForm/Inputs.js b/src/components/SurveyForm/Inputs.js new file mode 100644 index 000000000..c6221e7b8 --- /dev/null +++ b/src/components/SurveyForm/Inputs.js @@ -0,0 +1,51 @@ +import React from 'react'; + +const styles = require('./SurveyForm.scss'); + +const flags = (field) => +
+ {field.dirty && D} + {field.active && A} + {field.visited && V} + {field.touched && T} +
; + + +export const input = (field, label, asyncValidating, showAsyncValidating) => +
+ +
+ {showAsyncValidating && asyncValidating && } + + {field.error && field.touched &&
{field.error}
} + {flags(field)} +
+
; + +export const textArea = (field, label, asyncValidating, showAsyncValidating) => +
+ +
+ {showAsyncValidating && asyncValidating && } +