From f603707a50441595ea3a7d5b4ac2cd9655a8bebb Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Wed, 5 Jul 2023 11:43:10 +0200 Subject: [PATCH 1/2] fix: Apply input styles to all input fields --- .../common/AddressBookInput/index.tsx | 3 +- .../common/AddressBookInput/styles.module.css | 8 ---- src/components/common/AddressInput/index.tsx | 3 +- .../common/AddressInput/styles.module.css | 7 ---- .../common/DatePickerInput/index.tsx | 3 ++ src/components/common/NameInput/index.tsx | 4 +- .../common/NameInput/styles.module.css | 7 ---- src/components/new-safe/OwnerRow/index.tsx | 12 +----- .../new-safe/OwnerRow/styles.module.css | 12 ------ .../create/steps/OwnerPolicyStep/index.tsx | 39 ++++++++++--------- .../steps/OwnerPolicyStep/styles.module.css | 12 ------ .../steps/SetNameStep/styles.module.css | 2 +- .../transactions/TxFilterForm/index.tsx | 3 ++ .../tx-flow/flows/AddOwner/ChooseOwner.tsx | 17 ++++++-- src/styles/inputs.module.css | 34 ++++++++++++++++ 15 files changed, 82 insertions(+), 84 deletions(-) delete mode 100644 src/components/common/NameInput/styles.module.css delete mode 100644 src/components/new-safe/create/steps/OwnerPolicyStep/styles.module.css create mode 100644 src/styles/inputs.module.css diff --git a/src/components/common/AddressBookInput/index.tsx b/src/components/common/AddressBookInput/index.tsx index c76f8280aa..eaed6a892d 100644 --- a/src/components/common/AddressBookInput/index.tsx +++ b/src/components/common/AddressBookInput/index.tsx @@ -8,6 +8,7 @@ import EthHashInfo from '../EthHashInfo' import InfoIcon from '@/public/images/notifications/info.svg' import EntryDialog from '@/components/address-book/EntryDialog' import css from './styles.module.css' +import inputCss from '@/styles/inputs.module.css' const abFilterOptions = createFilterOptions({ stringify: (option: { label: string; name: string }) => option.name + ' ' + option.label, @@ -49,7 +50,7 @@ const AddressBookInput = ({ name, canAdd, ...props }: AddressInputProps & { canA open={open} onOpen={() => setOpen(true)} onClose={() => setOpen(false)} - className={css.input} + className={inputCss.input} disableClearable value={addressValue || ''} disabled={props.disabled} diff --git a/src/components/common/AddressBookInput/styles.module.css b/src/components/common/AddressBookInput/styles.module.css index d59ae6f44d..c1366746d2 100644 --- a/src/components/common/AddressBookInput/styles.module.css +++ b/src/components/common/AddressBookInput/styles.module.css @@ -18,11 +18,3 @@ text-decoration: underline; cursor: pointer; } - -.input :global .MuiInputBase-root fieldset { - border-width: 1px !important; -} - -.input :global .MuiInputBase-root:not(.Mui-error) fieldset { - border-color: var(--color-border-light) !important; -} diff --git a/src/components/common/AddressInput/index.tsx b/src/components/common/AddressInput/index.tsx index fae4fc7997..f993f50dfa 100644 --- a/src/components/common/AddressInput/index.tsx +++ b/src/components/common/AddressInput/index.tsx @@ -21,6 +21,7 @@ import CaretDownIcon from '@/public/images/common/caret-down.svg' import SaveAddressIcon from '@/public/images/common/save-address.svg' import classnames from 'classnames' import css from './styles.module.css' +import inputCss from '@/styles/inputs.module.css' export type AddressInputProps = TextFieldProps & { name: string @@ -115,7 +116,7 @@ const AddressInput = ({ <> {error?.message || props.label}} diff --git a/src/components/common/AddressInput/styles.module.css b/src/components/common/AddressInput/styles.module.css index 98473bc8f8..f5264e5ba8 100644 --- a/src/components/common/AddressInput/styles.module.css +++ b/src/components/common/AddressInput/styles.module.css @@ -1,10 +1,3 @@ -.wrapper :global .MuiInputBase-root { - background-color: var(--color-background-paper); - border-radius: 6px; - height: 66px; - padding: 12px var(--space-2); -} - .wrapper :global .MuiInputLabel-root.Mui-error[data-shrink='false'] { padding: 5px 4px; } diff --git a/src/components/common/DatePickerInput/index.tsx b/src/components/common/DatePickerInput/index.tsx index 08c9617d36..ed760e712e 100644 --- a/src/components/common/DatePickerInput/index.tsx +++ b/src/components/common/DatePickerInput/index.tsx @@ -5,6 +5,8 @@ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns' import TextField from '@mui/material/TextField' import { isFuture, isValid, startOfDay } from 'date-fns' +import inputCss from '@/styles/inputs.module.css' + const DatePickerInput = ({ name, label, @@ -46,6 +48,7 @@ const DatePickerInput = ({ render={({ field, fieldState }) => ( ) diff --git a/src/components/common/NameInput/styles.module.css b/src/components/common/NameInput/styles.module.css deleted file mode 100644 index b8f9ed84ce..0000000000 --- a/src/components/common/NameInput/styles.module.css +++ /dev/null @@ -1,7 +0,0 @@ -.textField { - margin-top: var(--space-1); -} - -.textField :global .MuiInputBase-input { - padding: 22px var(--space-2); -} diff --git a/src/components/new-safe/OwnerRow/index.tsx b/src/components/new-safe/OwnerRow/index.tsx index a97dadb770..d85b4ec8f2 100644 --- a/src/components/new-safe/OwnerRow/index.tsx +++ b/src/components/new-safe/OwnerRow/index.tsx @@ -78,7 +78,6 @@ export const OwnerRow = ({ {!readOnly && ( - + {removable && ( <> remove?.(index)} aria-label="Remove owner"> diff --git a/src/components/new-safe/OwnerRow/styles.module.css b/src/components/new-safe/OwnerRow/styles.module.css index d30004fee4..32d2f42aa0 100644 --- a/src/components/new-safe/OwnerRow/styles.module.css +++ b/src/components/new-safe/OwnerRow/styles.module.css @@ -1,15 +1,3 @@ -.name :global .MuiFormHelperText-root { - position: absolute; - bottom: -20px; -} - -@media (max-width: 899.95px) { - .name :global .MuiFormHelperText-root { - position: relative; - bottom: 0; - } -} - @media (min-width: 900px) { .helper { margin-bottom: var(--space-5); diff --git a/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx b/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx index e15941f2d9..81ee517a65 100644 --- a/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx +++ b/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx @@ -1,4 +1,4 @@ -import { Button, SvgIcon, MenuItem, Select, Tooltip, Typography, Divider, Box } from '@mui/material' +import { Button, SvgIcon, MenuItem, Tooltip, Typography, Divider, Box, Grid, TextField } from '@mui/material' import { Controller, FormProvider, useFieldArray, useForm } from 'react-hook-form' import type { ReactElement } from 'react' @@ -11,7 +11,6 @@ import type { CreateSafeInfoItem } from '@/components/new-safe/create/CreateSafe import { useSafeSetupHints } from '@/components/new-safe/create/steps/OwnerPolicyStep/useSafeSetupHints' import useSyncSafeCreationStep from '@/components/new-safe/create/useSyncSafeCreationStep' import ArrowBackIcon from '@mui/icons-material/ArrowBack' -import css from '@/components/new-safe/create/steps/OwnerPolicyStep/styles.module.css' import layoutCss from '@/components/new-safe/create/styles.module.css' import NetworkWarning from '@/components/new-safe/create/NetworkWarning' import useIsWrongChain from '@/hooks/useIsWrongChain' @@ -145,22 +144,26 @@ const OwnerPolicyStep = ({ Any transaction requires the confirmation of: - - ( - - )} - />{' '} - out of {ownerFields.length} owner(s). - + + + ( + + {ownerFields.map((_, idx) => ( + + {idx + 1} + + ))} + + )} + /> + + + out of {ownerFields.length} owner(s) + + {isWrongChain && } diff --git a/src/components/new-safe/create/steps/OwnerPolicyStep/styles.module.css b/src/components/new-safe/create/steps/OwnerPolicyStep/styles.module.css deleted file mode 100644 index c4083eb1ab..0000000000 --- a/src/components/new-safe/create/steps/OwnerPolicyStep/styles.module.css +++ /dev/null @@ -1,12 +0,0 @@ -.select { - margin-right: var(--space-1); -} - -.select :global .MuiOutlinedInput-notchedOutline { - border-color: var(--color-border-light); - border-width: 2px; -} - -.select :global .MuiSelect-select { - padding: 12px 14px; -} diff --git a/src/components/new-safe/create/steps/SetNameStep/styles.module.css b/src/components/new-safe/create/steps/SetNameStep/styles.module.css index e273a1c87e..6a8ce8b855 100644 --- a/src/components/new-safe/create/steps/SetNameStep/styles.module.css +++ b/src/components/new-safe/create/steps/SetNameStep/styles.module.css @@ -7,7 +7,7 @@ align-items: center; border-radius: 8px; border: 1px solid var(--color-border-light); - height: 56px; + height: 66px; } .select:hover, diff --git a/src/components/transactions/TxFilterForm/index.tsx b/src/components/transactions/TxFilterForm/index.tsx index c8d1c11490..dc07cb4c9e 100644 --- a/src/components/transactions/TxFilterForm/index.tsx +++ b/src/components/transactions/TxFilterForm/index.tsx @@ -21,6 +21,7 @@ import { useCurrentChain } from '@/hooks/useChains' import NumberField from '@/components/common/NumberField' import css from './styles.module.css' +import inputCss from '@/styles/inputs.module.css' enum TxFilterFormFieldNames { FILTER_TYPE = 'type', @@ -184,6 +185,7 @@ const TxFilterForm = ({ toggleFilter }: { toggleFilter: () => void }): ReactElem }} render={({ field, fieldState }) => ( void }): ReactElem }} render={({ field, fieldState }) => ( - + Current owner @@ -119,15 +120,23 @@ export const ChooseOwner = ({ Threshold - + + + + + Any transaction requires the confirmation of: - - + + Date: Wed, 5 Jul 2023 11:47:23 +0200 Subject: [PATCH 2/2] chore: Add TODO --- src/styles/inputs.module.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/styles/inputs.module.css b/src/styles/inputs.module.css index 7d14dc9632..0793279324 100644 --- a/src/styles/inputs.module.css +++ b/src/styles/inputs.module.css @@ -1,3 +1,4 @@ +/* TODO: Apply these styles in the MUI theme once its part of this repository */ .input :global .MuiFormHelperText-root { position: absolute; bottom: -20px;