diff --git a/services/frontend/src/components/Modal/network/General.tsx b/services/frontend/src/components/Modal/network/General.tsx index df01fb9..7851907 100644 --- a/services/frontend/src/components/Modal/network/General.tsx +++ b/services/frontend/src/components/Modal/network/General.tsx @@ -6,13 +6,34 @@ const Root = styled("div")` display: flex; flex-direction: column; row-gap: ${({ theme }) => theme.spacing(1)}; + @media (max-width: 640px) { + row-gap: 0; + } +`; + +const Group = styled("div")` + display: grid; + grid-template-columns: repeat(2, 1fr); + grid-column-gap: 0px; + grid-row-gap: 0px; + @media (max-width: 640px) { + grid-template-columns: repeat(1, 1fr); + } + column-gap: ${({ theme }) => theme.spacing(1)}; + width: 100%; `; const General = () => { return ( - - + + + + + + + + theme.spacing(1)}; + @media (max-width: 640px) { + row-gap: 0; + } +`; + +const Group = styled("div")` + display: grid; + grid-template-columns: repeat(2, 1fr); + grid-column-gap: 0px; + grid-row-gap: 0px; + @media (max-width: 640px) { + grid-template-columns: repeat(1, 1fr); + } + column-gap: ${({ theme }) => theme.spacing(1)}; width: 100%; `; @@ -44,8 +58,10 @@ const ConfigurationBorder = styled("div")` const IPAM: FunctionComponent = (): ReactElement => { return ( - - + + + + { {element} )} /> - + ); }; diff --git a/services/frontend/src/components/Modal/network/NetworkList.tsx b/services/frontend/src/components/Modal/network/NetworkList.tsx index 3f1700e..e0b2633 100644 --- a/services/frontend/src/components/Modal/network/NetworkList.tsx +++ b/services/frontend/src/components/Modal/network/NetworkList.tsx @@ -38,7 +38,7 @@ const ListItem = styled("div")` flex-direction: row; justify-content: space-between; align-items: center; - column-gap: ${({ theme }) => theme.spacing(2)}; + column-gap: ${({ theme }) => theme.spacing(1)}; padding: ${({ theme }) => theme.spacing(1, 1, 1, 2)}; cursor: pointer; background-color: ${({ selected }) => selected && "#f5f5f5"}; diff --git a/services/frontend/src/components/Modal/service/Accordion.tsx b/services/frontend/src/components/Modal/service/Accordion.tsx index 6c049f0..9959498 100644 --- a/services/frontend/src/components/Modal/service/Accordion.tsx +++ b/services/frontend/src/components/Modal/service/Accordion.tsx @@ -44,7 +44,6 @@ const Bottom = styled("div")` display: flex; flex-direction: column; row-gap: ${({ theme }) => theme.spacing(1)}; - padding: ${({ theme }) => theme.spacing(0, 2)}; `; const Accordion: FunctionComponent = ( diff --git a/services/frontend/src/components/Modal/service/Build.tsx b/services/frontend/src/components/Modal/service/Build.tsx index f84429b..d529963 100644 --- a/services/frontend/src/components/Modal/service/Build.tsx +++ b/services/frontend/src/components/Modal/service/Build.tsx @@ -6,6 +6,9 @@ const Root = styled("div")` display: flex; flex-direction: column; row-gap: ${({ theme }) => theme.spacing(1)}; + @media (max-width: 640px) { + row-gap: 0; + } `; const Build = () => { @@ -15,7 +18,7 @@ const Build = () => { - + diff --git a/services/frontend/src/components/Modal/service/Data.tsx b/services/frontend/src/components/Modal/service/Data.tsx index 34d19f6..0c28ec6 100644 --- a/services/frontend/src/components/Modal/service/Data.tsx +++ b/services/frontend/src/components/Modal/service/Data.tsx @@ -4,7 +4,10 @@ import Records from "../../Records"; const Root = styled("div")` display: flex; flex-direction: column; - align-items: center; + row-gap: ${({ theme }) => theme.spacing(1)}; + @media (max-width: 640px) { + row-gap: 0; + } `; const Volumes = () => { diff --git a/services/frontend/src/components/Modal/service/Deploy.tsx b/services/frontend/src/components/Modal/service/Deploy.tsx index 411b508..b64e0d4 100644 --- a/services/frontend/src/components/Modal/service/Deploy.tsx +++ b/services/frontend/src/components/Modal/service/Deploy.tsx @@ -9,6 +9,9 @@ const Root = styled("div")` display: flex; flex-direction: column; row-gap: ${({ theme }) => theme.spacing(1)}; + @media (max-width: 640px) { + row-gap: 0; + } `; const Group = styled("div")` diff --git a/services/frontend/src/components/Modal/service/Environment.tsx b/services/frontend/src/components/Modal/service/Environment.tsx index a404ed1..25552df 100644 --- a/services/frontend/src/components/Modal/service/Environment.tsx +++ b/services/frontend/src/components/Modal/service/Environment.tsx @@ -4,7 +4,10 @@ import Records from "../../Records"; const Root = styled("div")` display: flex; flex-direction: column; - align-items: center; + row-gap: ${({ theme }) => theme.spacing(1)}; + @media (max-width: 640px) { + row-gap: 0; + } `; const Environment = () => { diff --git a/services/frontend/src/components/Modal/service/General.tsx b/services/frontend/src/components/Modal/service/General.tsx index 9d5f38a..1823aee 100644 --- a/services/frontend/src/components/Modal/service/General.tsx +++ b/services/frontend/src/components/Modal/service/General.tsx @@ -14,7 +14,7 @@ const Root = styled("div")` const Group = styled("div")` display: grid; - grid-template-columns: repeat(3, 1fr); + grid-template-columns: repeat(2, 1fr); grid-column-gap: 0px; grid-row-gap: 0px; @media (max-width: 640px) { @@ -52,11 +52,15 @@ const General = () => { - + + + - + + + diff --git a/services/frontend/src/components/Modal/volume/General.tsx b/services/frontend/src/components/Modal/volume/General.tsx index c21bb2b..5532b11 100644 --- a/services/frontend/src/components/Modal/volume/General.tsx +++ b/services/frontend/src/components/Modal/volume/General.tsx @@ -7,13 +7,34 @@ const Root = styled("div")` display: flex; flex-direction: column; row-gap: ${({ theme }) => theme.spacing(1)}; + @media (max-width: 640px) { + row-gap: 0; + } +`; + +const Group = styled("div")` + display: grid; + grid-template-columns: repeat(2, 1fr); + grid-column-gap: 0px; + grid-row-gap: 0px; + @media (max-width: 640px) { + grid-template-columns: repeat(1, 1fr); + } + column-gap: ${({ theme }) => theme.spacing(1)}; + width: 100%; `; const General = () => { return ( - - + + + + + + + + theme.spacing(2)}; + column-gap: ${({ theme }) => theme.spacing(1)}; width: 100%; @media (max-width: 768px) { diff --git a/services/frontend/src/components/Records.tsx b/services/frontend/src/components/Records.tsx index 0e629ae..ed29a94 100644 --- a/services/frontend/src/components/Records.tsx +++ b/services/frontend/src/components/Records.tsx @@ -35,19 +35,19 @@ const Group = styled("div", { display: flex; flex-direction: column; align-items: ${({ empty }) => (empty ? "center" : "flex-end")}; - row-gap: ${({ theme }) => theme.spacing(1)}; width: 100%; @media (max-width: 640px) { row-gap: 0; } `; -const GroupTitle = styled("h5")` - font-size: 0.85rem; - color: #374151; +const GroupTitle = styled("label")` + display: block; + font-size: 0.75rem; + line-height: 1rem; font-weight: 700; - width: 100%; - text-align: left; + color: #374151; + padding: 0; `; const RecordList = styled("div")` @@ -56,7 +56,6 @@ const RecordList = styled("div")` justify-content: center; align-items: center; row-gap: ${({ theme }) => theme.spacing(1)}; - margin-top: ${({ theme }) => theme.spacing(1)}; width: 100%; `; diff --git a/services/frontend/src/utils/forms.ts b/services/frontend/src/utils/forms.ts index 5810897..4d6d4ca 100644 --- a/services/frontend/src/utils/forms.ts +++ b/services/frontend/src/utils/forms.ts @@ -196,6 +196,35 @@ export const packArrayAsStrings = ( ); }; +const isObject = (value: any) => { + return !!(value && typeof value === "object" && !Array.isArray(value)); +}; + +const digForString = (error: any[] | string) => { + if (lodash.isString(error) && /\s/.test(error)) { + toaster(error as string, "error"); + return; + } + + if (Array.isArray(error)) { + for (const message of error) { + digForString(message); + } + } + + if (isObject(error)) { + for (const [_, value] of Object.entries(error)) { + if (Array.isArray(value)) { + digForString(value); + } + + if (lodash.isString(value)) { + toaster(value as string, "error"); + } + } + } +}; + /** * Formik is configured to validate fields automatically using Yup. * The problem is Formik does not call `onSubmit` function when errors @@ -204,21 +233,9 @@ export const packArrayAsStrings = ( * function basically implements this. */ export const reportErrorsAndSubmit = (formik: any) => () => { - const errors = Object.entries(formik.errors); + const errors: [string, any][] = Object.entries(formik.errors); if (errors.length > 0) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - for (const [_field, message] of errors) { - if (Array.isArray(message)) { - message.forEach((m: object) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - for (const [_, value] of Object.entries(m)) { - toaster(value as string, "error"); - } - }); - } else { - toaster(message as string, "error"); - } - } + digForString(errors); } else { formik.submitForm(); }