Add hideErrorText prop to CustomThreshold
This commit is contained in:
1 parent
36d2a0aa85
commit
692c79024c
1 file changed
+55
-55
@@ -4,7 +4,6 @@ import Checkbox from "../../../../Components/Inputs/Checkbox";
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `CustomThreshold` is a functional React component that displays a
|
* `CustomThreshold` is a functional React component that displays a
|
||||||
* group of CheckBox with a label and its correspondant threshold input field.
|
* group of CheckBox with a label and its correspondant threshold input field.
|
||||||
@@ -24,60 +23,61 @@ import PropTypes from "prop-types";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const CustomThreshold = ({
|
export const CustomThreshold = ({
|
||||||
checkboxId,
|
checkboxId,
|
||||||
checkboxLabel,
|
checkboxLabel,
|
||||||
onCheckboxChange,
|
onCheckboxChange,
|
||||||
fieldId,
|
fieldId,
|
||||||
onFieldChange,
|
onFieldChange,
|
||||||
onFieldBlur,
|
onFieldBlur,
|
||||||
alertUnit,
|
alertUnit,
|
||||||
infrastructureMonitor,
|
infrastructureMonitor,
|
||||||
errors
|
errors,
|
||||||
}) =>
|
}) => {
|
||||||
{
|
const theme = useTheme();
|
||||||
const theme = useTheme();
|
return (
|
||||||
return (
|
<Stack
|
||||||
<Stack
|
direction={"row"}
|
||||||
direction={"row"}
|
sx={{
|
||||||
sx={{
|
width: "50%",
|
||||||
width: "50%",
|
justifyContent: "space-between",
|
||||||
justifyContent: "space-between",
|
flexWrap: "wrap",
|
||||||
flexWrap: "wrap"
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Box>
|
||||||
<Box>
|
<Checkbox
|
||||||
<Checkbox
|
id={checkboxId}
|
||||||
id={checkboxId}
|
label={checkboxLabel}
|
||||||
label={checkboxLabel}
|
isChecked={infrastructureMonitor[checkboxId]}
|
||||||
isChecked={infrastructureMonitor[checkboxId]}
|
onChange={onCheckboxChange}
|
||||||
onChange={onCheckboxChange}
|
/>
|
||||||
/>
|
</Box>
|
||||||
</Box>
|
<Stack
|
||||||
<Stack
|
direction={"row"}
|
||||||
direction={"row"}
|
sx={{
|
||||||
sx={{
|
justifyContent: "flex-end",
|
||||||
justifyContent: "flex-end",
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Field
|
||||||
<Field
|
type="number"
|
||||||
type="number"
|
className="field-infrastructure-alert"
|
||||||
className="field-infrastructure-alert"
|
id={fieldId}
|
||||||
id={fieldId}
|
value={infrastructureMonitor[fieldId]}
|
||||||
value={infrastructureMonitor[fieldId]}
|
onBlur={onFieldBlur}
|
||||||
onBlur={onFieldBlur}
|
onChange={onFieldChange}
|
||||||
onChange={onFieldChange}
|
error={errors[fieldId]}
|
||||||
error={errors[fieldId]}
|
disabled={!infrastructureMonitor[checkboxId]}
|
||||||
disabled={!infrastructureMonitor[checkboxId]}
|
hideErrorText={true}
|
||||||
></Field>
|
></Field>
|
||||||
<Typography
|
<Typography
|
||||||
component="p"
|
component="p"
|
||||||
m={theme.spacing(3)}
|
m={theme.spacing(3)}
|
||||||
>
|
>
|
||||||
{alertUnit}
|
{alertUnit}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
);
|
||||||
|
};
|
||||||
|
|
||||||
CustomThreshold.propTypes = {
|
CustomThreshold.propTypes = {
|
||||||
checkboxId: PropTypes.string.isRequired,
|
checkboxId: PropTypes.string.isRequired,
|
||||||
|
|||||||
Reference in new issue
Block a user