2021-08-10 11:18:48 +00:00
|
|
|
import React, { FunctionComponent } from "react";
|
2021-05-06 18:59:00 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { FormGroup } from "@patternfly/react-core";
|
|
|
|
|
|
|
|
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
|
|
|
|
|
|
|
export type FieldProps = { label: string; field: string; isReadOnly?: boolean };
|
2021-08-10 11:18:48 +00:00
|
|
|
export type FormGroupFieldProps = { label: string };
|
2021-05-06 18:59:00 +00:00
|
|
|
|
2021-08-10 11:18:48 +00:00
|
|
|
export const FormGroupField: FunctionComponent<FormGroupFieldProps> = ({
|
|
|
|
label,
|
|
|
|
children,
|
|
|
|
}) => {
|
2021-05-06 18:59:00 +00:00
|
|
|
const { t } = useTranslation("identity-providers");
|
|
|
|
return (
|
|
|
|
<FormGroup
|
|
|
|
label={t(label)}
|
|
|
|
fieldId={label}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
|
|
|
helpText={`identity-providers-help:${label}`}
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId={`identity-providers:${label}`}
|
2021-05-06 18:59:00 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</FormGroup>
|
|
|
|
);
|
|
|
|
};
|