From b552437327295a7222aca3c1478b0fa833fd4f20 Mon Sep 17 00:00:00 2001 From: Basile Spaenlehauer Date: Thu, 21 Nov 2024 14:02:23 +0100 Subject: [PATCH] fix: update adornemnt and use slotprops (#468) * fix: update adornemnt and use slotprops * fix: rename file * fix: temp rename file * fix: use correct file name --- .../settings/password/PasswordField.tsx | 20 ++++++++++--------- .../publicProfile/CustomTextField.tsx | 10 ++++++---- .../auth/components/common/PasswordInput.tsx | 2 +- .../common/{Adornments.tsx => adornments.tsx} | 9 ++++++++- .../auth/components/register/EmailInput.tsx | 8 +++++--- .../auth/components/register/Register.tsx | 8 +++++--- .../RequestPasswordReset.tsx | 14 +++++++------ .../requestPasswordReset/ResetPassword.tsx | 2 +- .../auth/components/signIn/EmailInput.tsx | 8 +++++--- src/routes/auth/reset-password.tsx | 2 +- 10 files changed, 51 insertions(+), 32 deletions(-) rename src/modules/auth/components/common/{Adornments.tsx => adornments.tsx} (61%) diff --git a/src/modules/account/settings/password/PasswordField.tsx b/src/modules/account/settings/password/PasswordField.tsx index 9c6239308..fc44fad01 100644 --- a/src/modules/account/settings/password/PasswordField.tsx +++ b/src/modules/account/settings/password/PasswordField.tsx @@ -24,15 +24,17 @@ export function PasswordField({ return ( - setShowPassword((s) => !s)}> - - - - ), + slotProps={{ + input: { + sx: { paddingRight: 0 }, + endAdornment: ( + + setShowPassword((s) => !s)}> + + + + ), + }, }} label={label} variant="outlined" diff --git a/src/modules/account/settings/publicProfile/CustomTextField.tsx b/src/modules/account/settings/publicProfile/CustomTextField.tsx index bd0a1ab93..ac63ba3fd 100644 --- a/src/modules/account/settings/publicProfile/CustomTextField.tsx +++ b/src/modules/account/settings/publicProfile/CustomTextField.tsx @@ -43,11 +43,13 @@ export function CustomTextField({ rows={rows} required={required} multiline={multiline} - InputProps={ + slotProps={ Icon && { - startAdornment: ( - {Icon} - ), + input: { + startAdornment: ( + {Icon} + ), + }, } } id={id} diff --git a/src/modules/auth/components/common/PasswordInput.tsx b/src/modules/auth/components/common/PasswordInput.tsx index 67b233e37..27c76f15e 100644 --- a/src/modules/auth/components/common/PasswordInput.tsx +++ b/src/modules/auth/components/common/PasswordInput.tsx @@ -10,8 +10,8 @@ import { NS } from '@/config/constants'; import { AUTH } from '~auth/langs'; -import { PasswordAdornment } from './Adornments'; import { StyledTextField } from './StyledTextField'; +import { PasswordAdornment } from './adornments'; type Props = { id: string; diff --git a/src/modules/auth/components/common/Adornments.tsx b/src/modules/auth/components/common/adornments.tsx similarity index 61% rename from src/modules/auth/components/common/Adornments.tsx rename to src/modules/auth/components/common/adornments.tsx index 7d0f8dd21..755042d89 100644 --- a/src/modules/auth/components/common/Adornments.tsx +++ b/src/modules/auth/components/common/adornments.tsx @@ -1,12 +1,19 @@ import { InputAdornment } from '@mui/material'; -import { LockIcon, MailIcon } from 'lucide-react'; +import { LockIcon, MailIcon, UserRoundIcon } from 'lucide-react'; export const EmailAdornment = ( ); + +export const NameAdornment = ( + + + +); + export const PasswordAdornment = ( diff --git a/src/modules/auth/components/register/EmailInput.tsx b/src/modules/auth/components/register/EmailInput.tsx index ac2a4b9ba..7e0403780 100644 --- a/src/modules/auth/components/register/EmailInput.tsx +++ b/src/modules/auth/components/register/EmailInput.tsx @@ -6,8 +6,8 @@ import { NS } from '@/config/constants'; import { AUTH } from '~auth/langs'; import { emailValidator } from '~auth/validation'; -import { EmailAdornment } from '../common/Adornments'; import { StyledTextField } from '../common/StyledTextField'; +import { EmailAdornment } from '../common/adornments'; type Props = { required?: boolean; @@ -52,8 +52,10 @@ export function EmailInput({ return ( isEmail(email, {}) || t(AUTH.INVALID_EMAIL_ERROR), })} - FormHelperTextProps={{ - id: REQUEST_PASSWORD_RESET_EMAIL_FIELD_HELPER_ID, - }} - InputProps={{ - startAdornment: EmailAdornment, + slotProps={{ + input: { + startAdornment: EmailAdornment, + }, + formHelperText: { + id: REQUEST_PASSWORD_RESET_EMAIL_FIELD_HELPER_ID, + }, }} placeholder={t(AUTH.EMAIL_INPUT_PLACEHOLDER)} helperText={errorMessage} diff --git a/src/modules/auth/components/requestPasswordReset/ResetPassword.tsx b/src/modules/auth/components/requestPasswordReset/ResetPassword.tsx index 8738b617b..51e663caa 100644 --- a/src/modules/auth/components/requestPasswordReset/ResetPassword.tsx +++ b/src/modules/auth/components/requestPasswordReset/ResetPassword.tsx @@ -35,7 +35,7 @@ import { HELP_EMAIL } from '~auth/constants'; import { useValidateJWTToken } from '~auth/hooks/useValidateJWTToken'; import { AUTH } from '~auth/langs'; -import { PasswordAdornment } from '../common/Adornments'; +import { PasswordAdornment } from '../common/adornments'; import { CenteredContent } from '../layout/CenteredContent'; import { DialogHeader } from '../layout/DialogHeader'; import { InvalidTokenScreen } from './InvalidTokenScreen'; diff --git a/src/modules/auth/components/signIn/EmailInput.tsx b/src/modules/auth/components/signIn/EmailInput.tsx index 00a6a35e7..2196b19da 100644 --- a/src/modules/auth/components/signIn/EmailInput.tsx +++ b/src/modules/auth/components/signIn/EmailInput.tsx @@ -3,8 +3,8 @@ import { useTranslation } from 'react-i18next'; import { NS } from '@/config/constants'; -import { EmailAdornment } from '../common/Adornments'; import { StyledTextField } from '../common/StyledTextField'; +import { EmailAdornment } from '../common/adornments'; type Props = { id?: string; @@ -28,8 +28,10 @@ export function EmailInput({ return (