Skip to content

Commit

Permalink
Merge pull request #477 from appfolio/deprecateValidatedFormGroup
Browse files Browse the repository at this point in the history
Deprecate and correct ValidatedFormGroup
  • Loading branch information
gthomas-appfolio authored Oct 9, 2018
2 parents 78cc7e8 + 3071315 commit 7df8602
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/components/ValidatedFormGroup.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import PropTypes from 'prop-types';
import React from 'react';
import FormFeedback from './FormFeedback';
import FormGroup from './FormGroup';
import { warnOnce } from 'reactstrap/lib/utils';
import FormLabelGroup from './FormLabelGroup';
import Label from './Label';

const ValidatedFormGroup = ({ children, error, label, labelTag: Tag, ...props }) => (
<FormGroup color={error && 'danger'} {...props}>
{label && <Tag>{label}</Tag>}
{children}
{error && <FormFeedback>{error}</FormFeedback>}
</FormGroup>
);
const ValidatedFormGroup = ({ children, error, label, labelTag: Tag, ...props }) => {
warnOnce('The "ValidatedFormGroup" component has been deprecated.\nPlease use component "FormLabelGroup".');
return (
<FormLabelGroup
label={label}
feedback={error}
{...props}
>
{children}
</FormLabelGroup>
);
};

export default ValidatedFormGroup;

ValidatedFormGroup.defaultProps = {
Expand Down

0 comments on commit 7df8602

Please sign in to comment.