Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import {
Expand All @@ -12,11 +12,22 @@ import { Icon } from '@patternfly/react-core';
import { WarningTriangleIcon, ErrorCircleOIcon } from '@patternfly/react-icons';
import InputFactory from './InputFactory';
import { noop } from '../../../common/helpers';
import { deprecate } from '../../../common/DeprecationService';

const InlineMessage = ({ error, warning, helpInline }) => {
if (!error && !warning && !helpInline) {
return null;
}

// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
deprecate(
`InlineMessage from common/forms/FormField`,
'Form from @patternfly/react-core',
'5.1'
);
}, []);

return (
<HelpBlock
className={classNames('help-inline', {
Expand Down Expand Up @@ -89,6 +100,14 @@ const FormField = ({
if (innerWarning) validationState = 'warning';
if (innerError) validationState = 'error';

useEffect(() => {
deprecate(
`common/forms/FormField`,
'Form from @patternfly/react-core',
'5.1'
);
}, []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels strange to see this twice in the same file, I see it's because FormField.js exports also InlineMessage. I found only one use of InlineMessage in a test snapshot. So I wonder if it would be too much of a hustle to either separate that thing into it's own file or just drop it with the snapshot test, that should be dropped sooner or later anyway

return (
<FormGroup
controlId={id}
Expand Down
Loading