From 3349a920d9e63aa52fbb829d7f2768f45be37ae6 Mon Sep 17 00:00:00 2001 From: Patricio Marroquin <55117912+patricio0312rev@users.noreply.github.com> Date: Mon, 28 Oct 2024 07:42:59 -0500 Subject: [PATCH] refactor: form label hover on delete modal (#765) --- src/app/components/Form/FormField.tsx | 14 ++- .../__snapshots__/InputDate.test.tsx.snap | 2 +- .../PasswordValidation.test.tsx.snap | 4 +- .../PasswordValidation.test.tsx.snap.orig | 4 +- .../WalletListItem.test.tsx.snap | 14 +-- .../__snapshots__/ContactForm.test.tsx.snap | 12 +-- .../__snapshots__/CreateContact.test.tsx.snap | 6 +- .../__snapshots__/UpdateContact.test.tsx.snap | 18 ++-- .../__snapshots__/ExchangeForm.test.tsx.snap | 22 ++--- .../__snapshots__/SignMessage.test.tsx.snap | 12 +-- .../__snapshots__/SuccessStep.test.tsx.snap | 4 +- .../__snapshots__/VerifyMessage.test.tsx.snap | 12 +-- .../__snapshots__/PasswordModal.test.tsx.snap | 2 +- .../SignIn/__snapshots__/SignIn.test.tsx.snap | 2 +- .../PasswordRemovalConfirmModal.test.tsx.snap | 2 +- .../__snapshots__/General.test.tsx.snap | 98 +++++++++---------- .../__snapshots__/General.test.tsx.snap.orig | 98 +++++++++---------- .../__snapshots__/Password.test.tsx.snap | 16 +-- .../__snapshots__/Password.test.tsx.snap.orig | 22 ++--- .../__snapshots__/AddRecipient.test.tsx.snap | 36 +++---- .../AddRecipient.test.tsx.snap.orig | 36 +++---- .../AuthenticationStep.test.tsx.snap | 28 +++--- .../AuthenticationStep.test.tsx.snap.orig | 28 +++--- ...firmRemovePendingTransaction.test.tsx.snap | 4 +- .../DelegateRegistrationForm.test.tsx.snap | 20 ++-- ...elegateRegistrationForm.test.tsx.snap.orig | 20 ++-- .../__snapshots__/FeeWarning.test.tsx.snap | 4 +- ...ltiSignatureRegistrationForm.test.tsx.snap | 10 +- .../AddParticipant.test.tsx.snap | 14 +-- .../AddParticipant.test.tsx.snap.orig | 14 +-- ...ondSignatureRegistrationForm.test.tsx.snap | 8 +- .../TransactionExportForm.test.tsx.snap | 24 ++--- .../TransactionExportModal.test.tsx.snap | 20 ++-- .../UnlockTokensAuthentication.test.tsx.snap | 2 +- .../SendDelegateResignation.test.tsx.snap | 16 +-- .../__snapshots__/SendIpfs.test.tsx.snap | 14 +-- ...Registration.SecondSignature.test.tsx.snap | 2 +- .../SendRegistration.test.tsx.snap | 4 +- ...endTransfer.NetworkSelection.test.tsx.snap | 2 +- .../__snapshots__/SendTransfer.test.tsx.snap | 28 +++--- .../SendTransfer.test.tsx.snap.orig | 28 +++--- .../__snapshots__/SendVote.test.tsx.snap | 2 +- .../components/DeleteWallet/DeleteWallet.tsx | 3 +- .../__snapshots__/DeleteWallet.test.tsx.snap | 18 +--- .../EncryptPasswordStep.test.tsx.snap | 4 +- .../__snapshots__/NetworkStep.test.tsx.snap | 6 +- .../ReceiveFundsForm.test.tsx.snap | 14 +-- .../UpdateWalletName.test.tsx.snap | 14 +-- .../__snapshots__/CreateWallet.test.tsx.snap | 10 +- .../__snapshots__/LedgerTabs.test.tsx.snap | 2 +- .../ImportWallet.WIF.test.tsx.snap | 8 +- .../__snapshots__/ImportWallet.test.tsx.snap | 28 +++--- 52 files changed, 414 insertions(+), 421 deletions(-) diff --git a/src/app/components/Form/FormField.tsx b/src/app/components/Form/FormField.tsx index 0d8b961298..616a13ccea 100644 --- a/src/app/components/Form/FormField.tsx +++ b/src/app/components/Form/FormField.tsx @@ -7,11 +7,12 @@ import { FormFieldProvider } from "./useFormField"; type FormFieldProperties = { name: string; + disableHover?: boolean; } & React.FieldsetHTMLAttributes; -export const FormFieldStyled = styled.fieldset<{ isInvalid: boolean }>` +export const FormFieldStyled = styled.fieldset<{ isInvalid: boolean; disableHover: boolean }>` &:hover .FormLabel { - ${({ isInvalid }) => !isInvalid && tw`text-theme-primary-600`}; + ${({ isInvalid, disableHover }) => !isInvalid && !disableHover && tw`text-theme-primary-600`} } .FormLabel { ${({ isInvalid }) => isInvalid && tw`text-theme-danger-500`}; @@ -21,7 +22,7 @@ export const FormFieldStyled = styled.fieldset<{ isInvalid: boolean }>` } `; -export const FormField: React.FC = ({ name, ...properties }) => { +export const FormField: React.FC = ({ name, disableHover = false, ...properties }) => { const FormProvider = useFormContext(); const { isInvalid, errorMessage } = React.useMemo(() => { const error: { message: string } | undefined = get(FormProvider?.errors, name); @@ -33,7 +34,12 @@ export const FormField: React.FC = ({ name, ...properties } }, [FormProvider, name]); return ( - + <>{properties.children} diff --git a/src/app/components/Input/__snapshots__/InputDate.test.tsx.snap b/src/app/components/Input/__snapshots__/InputDate.test.tsx.snap index b51444295c..3e9e9b02da 100644 --- a/src/app/components/Input/__snapshots__/InputDate.test.tsx.snap +++ b/src/app/components/Input/__snapshots__/InputDate.test.tsx.snap @@ -3,7 +3,7 @@ exports[`InputDate > should render 1`] = `
should render password rules 1`] = `