The `import/order` rule isn't enough to sort import within a single import group alphabetically. This adds `sort-imports` rule that handles the sorting within groups.
41 lines
860 B
TypeScript
41 lines
860 B
TypeScript
import React from 'react';
|
|
|
|
import {
|
|
FormHelperText,
|
|
HelperText,
|
|
HelperTextItem,
|
|
} from '@patternfly/react-core';
|
|
import { ExclamationCircleIcon } from '@patternfly/react-icons';
|
|
export type HelperTextVariant =
|
|
| 'default'
|
|
| 'indeterminate'
|
|
| 'warning'
|
|
| 'success'
|
|
| 'error';
|
|
|
|
interface Props {
|
|
variant?: HelperTextVariant;
|
|
textValue?: string;
|
|
defaultText?: string;
|
|
hide?: boolean;
|
|
}
|
|
|
|
const CustomHelperText = ({
|
|
hide = false,
|
|
variant = 'error',
|
|
textValue = '',
|
|
defaultText = '',
|
|
}: Props) =>
|
|
(!!textValue || !!defaultText) && !hide ? (
|
|
<FormHelperText>
|
|
<HelperText>
|
|
<HelperTextItem icon={<ExclamationCircleIcon />} variant={variant}>
|
|
{textValue ? textValue : defaultText}
|
|
</HelperTextItem>
|
|
</HelperText>
|
|
</FormHelperText>
|
|
) : (
|
|
<></>
|
|
);
|
|
|
|
export default CustomHelperText;
|