Skip to content

Commit 8817eb8

Browse files
HedwigJDoetsgjulivan
authored andcommitted
fix: add error suffix to combobox instead of in alert, rename id prop
1 parent 77d0f4a commit 8817eb8

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

packages/pluggableWidgets/combobox-web/src/components/ComboboxWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const ComboboxWrapper = forwardRef(
5757
</div>
5858
)}
5959
</div>
60-
{validation && <ValidationAlert referenceId={inputId}>{validation}</ValidationAlert>}
60+
{validation && <ValidationAlert referenceId={inputId + "-error"}>{validation}</ValidationAlert>}
6161
</Fragment>
6262
);
6363
}

packages/shared/widget-plugin-component-kit/src/Alert.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface AlertProps {
55
children?: ReactNode;
66
className?: string;
77
bootstrapStyle: "default" | "primary" | "success" | "info" | "warning" | "danger";
8-
inputElementId?: string;
8+
id?: string;
99
role?: string;
1010
}
1111

@@ -21,19 +21,15 @@ export const ValidationAlert = ({ className, children, referenceId }: Validation
2121
className={classNames("mx-validation-message", className)}
2222
bootstrapStyle="danger"
2323
role="alert"
24-
inputElementId={referenceId}
24+
id={referenceId}
2525
>
2626
{children}
2727
</Alert>
2828
);
2929

30-
export const Alert = ({ className, bootstrapStyle, children, role, inputElementId }: AlertProps): ReactNode =>
30+
export const Alert = ({ className, bootstrapStyle, children, role, id }: AlertProps): ReactNode =>
3131
Children.count(children) > 0 ? (
32-
<div
33-
className={classNames(`alert alert-${bootstrapStyle}`, className)}
34-
role={role}
35-
{...(inputElementId ? { id: inputElementId + "-error" } : undefined)}
36-
>
32+
<div className={classNames(`alert alert-${bootstrapStyle}`, className)} role={role} id={id}>
3733
{children}
3834
</div>
3935
) : null;

0 commit comments

Comments
 (0)