From acb987cf60248752c6ea968189569a08d279d84a Mon Sep 17 00:00:00 2001 From: corpulent Date: Tue, 9 Aug 2022 12:00:34 +0300 Subject: [PATCH] fix: initial grid improvements --- .../src/components/Modal/service/General.tsx | 104 ++++++++++++------ services/frontend/src/components/Record.tsx | 18 +-- services/frontend/src/components/Records.tsx | 4 +- .../global/FormElements/TextField.tsx | 48 ++++---- .../components/global/FormElements/Toggle.tsx | 16 ++- 5 files changed, 119 insertions(+), 71 deletions(-) diff --git a/services/frontend/src/components/Modal/service/General.tsx b/services/frontend/src/components/Modal/service/General.tsx index 4f556fd..9d5f38a 100644 --- a/services/frontend/src/components/Modal/service/General.tsx +++ b/services/frontend/src/components/Modal/service/General.tsx @@ -7,56 +7,98 @@ 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: flex; - flex-direction: row; + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-column-gap: 0px; + grid-row-gap: 0px; @media (max-width: 640px) { - flex-direction: column; + grid-template-columns: repeat(1, 1fr); } column-gap: ${({ theme }) => theme.spacing(1)}; width: 100%; `; +const SpanTwo = styled("div")` + grid-column: span 2; + @media (max-width: 640px) { + grid-column: span 3; + } +`; + const General = () => { return ( - + + + - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + = ( )) )} {renderRemoveWrapper( - - - +
+ + + +
)}
); diff --git a/services/frontend/src/components/Records.tsx b/services/frontend/src/components/Records.tsx index 9496246..0e629ae 100644 --- a/services/frontend/src/components/Records.tsx +++ b/services/frontend/src/components/Records.tsx @@ -37,6 +37,9 @@ const Group = styled("div", { 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")` @@ -58,7 +61,6 @@ const RecordList = styled("div")` `; const AddButton = styled(IconButton)` - margin-top: ${({ theme }) => theme.spacing(1)}; border-radius: ${({ theme }) => theme.spacing(2)}; `; diff --git a/services/frontend/src/components/global/FormElements/TextField.tsx b/services/frontend/src/components/global/FormElements/TextField.tsx index ec02f78..4a2c3ae 100644 --- a/services/frontend/src/components/global/FormElements/TextField.tsx +++ b/services/frontend/src/components/global/FormElements/TextField.tsx @@ -9,11 +9,7 @@ export interface ITextFieldProps { [key: string]: any; } -const Root = styled("div")` - display: flex; - flex-direction: column; - width: 100%; -`; +const Root = styled("div")``; const TextField: FunctionComponent = ( props: ITextFieldProps @@ -25,28 +21,30 @@ const TextField: FunctionComponent = ( return ( - {label && ( - - )} +
+ {label && ( + + )} - + -
- {error && {error}} - {!error && help} +
+ {error && {error}} + {!error && help} +
); diff --git a/services/frontend/src/components/global/FormElements/Toggle.tsx b/services/frontend/src/components/global/FormElements/Toggle.tsx index 7c6691c..6a4d07c 100644 --- a/services/frontend/src/components/global/FormElements/Toggle.tsx +++ b/services/frontend/src/components/global/FormElements/Toggle.tsx @@ -1,6 +1,6 @@ import lodash from "lodash"; import { useFormikContext } from "formik"; -import { Fragment, FunctionComponent, ReactElement, useCallback } from "react"; +import { Fragment, FunctionComponent, ReactElement } from "react"; import { Button, styled } from "@mui/joy"; export interface IToggleProps { @@ -25,16 +25,21 @@ const Root = styled("div")` `; const Label = styled("label")` + margin-bottom: 0.25rem; + display: block; + font-size: 0.75rem; + line-height: 1rem; + font-weight: 700; color: #374151; - font-size: 12px; - font-weight: 500; padding: 0; - margin: 0; `; const Buttons = styled("div")` display: flex; flex-direction: row; + @media (max-width: 640px) { + margin-bottom: 0.5rem; + } `; const ToggleButton = styled(Button)(({ index, total }) => ({ @@ -44,8 +49,7 @@ const ToggleButton = styled(Button)(({ index, total }) => ({ ${index === total - 1 ? "8px" : "0px"} ${index === 0 ? "8px" : "0px"} `, - fontSize: 11, - minWidth: 120 + fontSize: 11 })); const ButtonBorder = styled("div")`