1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
import React from 'react'; import classNames from 'classnames'; import { NgCmd, } from './../../_component';
const TextField = ({ input, label, labelClassName, inputDivClassName, className, type, maxLength, row, meta: { touched, error, warning }, }) => ( <div className={classNames(className, 'has-feedback', { 'has-error': touched && error, 'has-warning': touched && !error && warning, 'has-success': touched && !error && !warning, })}> <label className={classNames('control-label', labelClassName)}>{label}</label> <div className={classNames(inputDivClassName, { 'hint--bottom-right hint-error': touched && error, 'hint--bottom-right hint-warning': touched && !error && warning, })} aria-label={error || warning}> <NgCmd if={!row}> <input className="form-control" type={type || 'text'} maxLength={maxLength} {...input} /> </NgCmd> <NgCmd if={!!row}> <textarea className="form-control" row={row} maxLength={maxLength} {...input} /> </NgCmd> <span className={classNames('glyphicon form-control-feedback', { 'glyphicon-remove': touched && error, 'glyphicon-warning-sign': touched && !error && warning, 'glyphicon-ok': touched && !error && !warning, })} /> </div> </div> )
export default TextField;
import React from 'react'; import classNames from 'classnames'; import { DateTimePicker, } from './../../_component';
const DateTimePickerField = ({ input, label, labelClassName, inputDivClassName, className, meta: { touched, error, warning }, ...rest, }) => ( <div className={classNames(className, 'has-feedback date-time-picker', { 'has-error': touched && error, 'has-warning': touched && !error && warning, 'has-success': touched && !error && !warning, })}> <label className={classNames('control-label', labelClassName)}>{label}</label> <div className={classNames(inputDivClassName, { 'hint--bottom-right hint-error': touched && error, 'hint--bottom-right hint-warning': touched && !error && warning, })} aria-label={error || warning}> <DateTimePicker {...input} {...rest} /> <span className={classNames('glyphicon form-control-feedback', { 'glyphicon-remove': touched && error, 'glyphicon-warning-sign': touched && !error && warning, 'glyphicon-ok': touched && !error && !warning, })} /> </div> </div> )
export default DateTimePickerField;
|