Skip to content

Commit

Permalink
Merge pull request #87 from irontec/IUI-fix-add-helper-text-in-custom…
Browse files Browse the repository at this point in the history
…-wrapper-component

Added helper component into CustomWrapper
  • Loading branch information
rbatistadev authored Jun 26, 2023
2 parents 8d2e637 + 6e15c9b commit 03a921a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion library/src/services/form/Field/CustomComponentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
StyledFieldsetRoot,
StyledFieldset,
} from './CustomComponentWrapper.styles';
import { StyledHelpTextTooltip } from './Shared/HelpText.styles';
import HelpOutlineIcon from '@mui/icons-material/HelpOutline';

export enum CustomFunctionComponentContext {
write = 'write',
Expand Down Expand Up @@ -60,10 +62,27 @@ export const CustomComponentWrapper: React.FunctionComponent<
CustomComponentWrapperProps
> = (props: CustomComponentWrapperProps): JSX.Element => {
const { property, hasChanged, disabled } = props;
const helpText = property.helpText;

const label = helpText ? (
<>
{property.label}
<StyledHelpTextTooltip
title={helpText}
placement='top'
arrow
className='help-tooltip'
>
<HelpOutlineIcon />
</StyledHelpTextTooltip>
</>
) : (
property.label
);

return (
<StyledFieldsetRoot
label={property.label}
label={label}
hasChanged={hasChanged}
disabled={disabled}
>
Expand Down

0 comments on commit 03a921a

Please sign in to comment.