fix label and description regression
This commit is contained in:
1 parent
c5ef61e64c
commit
c578387261
2 files changed
+18
No files matched your search
@@ -23,6 +23,7 @@ interface FormMultiSelectFieldProps<T extends FieldValues, O extends MultiSelect
|
|||||||
name: FieldPath<T>;
|
name: FieldPath<T>;
|
||||||
options: O[];
|
options: O[];
|
||||||
fieldLabel?: string;
|
fieldLabel?: string;
|
||||||
|
description?: string;
|
||||||
renderRow?: (option: O) => React.ReactNode;
|
renderRow?: (option: O) => React.ReactNode;
|
||||||
renderOptionContent?: (option: O) => React.ReactNode;
|
renderOptionContent?: (option: O) => React.ReactNode;
|
||||||
}
|
}
|
||||||
@@ -31,6 +32,7 @@ export const FormMultiSelectField = <T extends FieldValues, O extends MultiSelec
|
|||||||
name,
|
name,
|
||||||
options,
|
options,
|
||||||
fieldLabel,
|
fieldLabel,
|
||||||
|
description,
|
||||||
renderRow,
|
renderRow,
|
||||||
renderOptionContent,
|
renderOptionContent,
|
||||||
}: FormMultiSelectFieldProps<T, O>) => {
|
}: FormMultiSelectFieldProps<T, O>) => {
|
||||||
@@ -47,6 +49,7 @@ export const FormMultiSelectField = <T extends FieldValues, O extends MultiSelec
|
|||||||
<Stack spacing={theme.spacing(LAYOUT.MD)}>
|
<Stack spacing={theme.spacing(LAYOUT.MD)}>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
multiple
|
multiple
|
||||||
|
autoHighlight
|
||||||
options={options}
|
options={options}
|
||||||
value={selected}
|
value={selected}
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
@@ -59,6 +62,15 @@ export const FormMultiSelectField = <T extends FieldValues, O extends MultiSelec
|
|||||||
error={!!fieldState.error}
|
error={!!fieldState.error}
|
||||||
helperText={fieldState.error?.message ?? ""}
|
helperText={fieldState.error?.message ?? ""}
|
||||||
/>
|
/>
|
||||||
|
{description && (
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
color={theme.palette.text.secondary}
|
||||||
|
sx={{ opacity: 0.8 }}
|
||||||
|
>
|
||||||
|
{description}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
{selected.map((option, index) => (
|
{selected.map((option, index) => (
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
|
|||||||
@@ -929,6 +929,12 @@ const CreateMonitorPage = () => {
|
|||||||
<FormMultiSelectField
|
<FormMultiSelectField
|
||||||
name="customUpCodes"
|
name="customUpCodes"
|
||||||
options={ALL_HTTP_STATUS_CODES}
|
options={ALL_HTTP_STATUS_CODES}
|
||||||
|
fieldLabel={t(
|
||||||
|
"pages.createMonitor.form.advanced.option.customUpCodes.label"
|
||||||
|
)}
|
||||||
|
description={t(
|
||||||
|
"pages.createMonitor.form.advanced.option.customUpCodes.description"
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{watchedMethod !== "HEAD" && (
|
{watchedMethod !== "HEAD" && (
|
||||||
|
|||||||
Reference in new issue
Block a user