fixed proptypes bug, changed validationmessage to use mode

This commit is contained in:
Ben Wheeler 2019-08-16 17:58:10 -04:00
parent 0998171a67
commit ff2cab476d
4 changed files with 9 additions and 10 deletions

View file

@ -34,15 +34,15 @@ const FormikInput = ({
/> />
{error ? ( {error ? (
<ValidationMessage <ValidationMessage
isError
className={validationClassName} className={validationClassName}
message={error} message={error}
mode="error"
/> />
) : toolTip && ( ) : toolTip && (
<ValidationMessage <ValidationMessage
isOk
className={validationClassName} className={validationClassName}
message={toolTip} message={toolTip}
mode="info"
/> />
)} )}
</div> </div>
@ -52,7 +52,7 @@ const FormikInput = ({
FormikInput.propTypes = { FormikInput.propTypes = {
className: PropTypes.string, className: PropTypes.string,
error: PropTypes.string, error: PropTypes.string,
toolTip: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), toolTip: PropTypes.string,
type: PropTypes.string, type: PropTypes.string,
validationClassName: PropTypes.string, validationClassName: PropTypes.string,
wrapperClassName: PropTypes.string wrapperClassName: PropTypes.string

View file

@ -37,9 +37,9 @@ const FormikSelect = ({
</Field> </Field>
{error && ( {error && (
<ValidationMessage <ValidationMessage
isError
className={validationClassName} className={validationClassName}
message={error} message={error}
mode="error"
/> />
)} )}
</div> </div>

View file

@ -9,8 +9,8 @@ const ValidationMessage = props => (
className={classNames( className={classNames(
'validation-message', 'validation-message',
{ {
'validation-error': props.isError, 'validation-error': props.mode === 'error',
'validation-ok': props.isOk 'validation-info': props.mode === 'info'
}, },
props.className props.className
)} )}
@ -21,9 +21,8 @@ const ValidationMessage = props => (
ValidationMessage.propTypes = { ValidationMessage.propTypes = {
className: PropTypes.string, className: PropTypes.string,
isError: PropTypes.bool, message: PropTypes.string,
isOk: PropTypes.bool, mode: PropTypes.string
message: PropTypes.string
}; };
module.exports = ValidationMessage; module.exports = ValidationMessage;

View file

@ -59,7 +59,7 @@
} }
} }
.validation-ok { .validation-info {
background-color: $ui-blue; background-color: $ui-blue;
&:before { &:before {