Skip to content

Commit

Permalink
feat(ui-hydro): update Inflow Structure form style
Browse files Browse the repository at this point in the history
  • Loading branch information
skamril committed Feb 1, 2024
1 parent 0b37aab commit 1b8aa01
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "./utils";
import NumberFE from "../../../../../../../common/fieldEditors/NumberFE";
import { SubmitHandlerPlus } from "../../../../../../../common/Form/types";
import { Box } from "@mui/material";
import { useTranslation } from "react-i18next";

function InflowStructure() {
Expand All @@ -31,48 +30,37 @@ function InflowStructure() {
////////////////////////////////////////////////////////////////

return (
<Box
sx={{
display: "flex",
flexDirection: "row",
width: 1,
<Form
key={study.id + areaId}
config={{
defaultValues: () => getInflowStructureFields(study.id, areaId),
}}
onSubmit={handleSubmit}
miniSubmitButton
enableUndoRedo
sx={{ display: "flex", alignItems: "center", ".Form__Footer": { p: 0 } }}
>
<Form
key={study.id + areaId}
config={{
defaultValues: () => getInflowStructureFields(study.id, areaId),
}}
onSubmit={handleSubmit}
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
py: 1,
}}
enableUndoRedo
>
{({ control }) => (
<NumberFE
label="Inter-Monthly Correlation"
name="interMonthlyCorrelation"
control={control}
fullWidth
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
max: {
value: 1,
message: t("form.field.maxValue", { 0: 1 }),
},
}}
inputProps={{ step: 0.1 }}
/>
)}
</Form>
</Box>
{({ control }) => (
<NumberFE
label="Inter-Monthly Correlation"
name="interMonthlyCorrelation"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
max: {
value: 1,
message: t("form.field.maxValue", { 0: 1 }),
},
}}
inputProps={{ step: 0.1 }}
size="small"
sx={{ width: 180 }}
/>
)}
</Form>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Box } from "@mui/material";
import SplitView, { SplitViewProps } from "../../../../../../common/SplitView";
import HydroMatrix from "./HydroMatrix";
import { HydroMatrixType } from "./utils";
Expand All @@ -12,7 +13,11 @@ interface Props {
function SplitHydroMatrix({ types, direction, sizes, form: Form }: Props) {
return (
<>
{Form && <Form />}
{Form && (
<Box sx={{ width: 1, py: 1 }}>
<Form />
</Box>
)}
<SplitView direction={direction} sizes={sizes}>
<HydroMatrix type={types[0]} />
<HydroMatrix type={types[1]} />
Expand Down

0 comments on commit 1b8aa01

Please sign in to comment.