Skip to content

Commit

Permalink
fix: allow InputProps default to be overriden
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jun 26, 2023
1 parent 3f550d5 commit 4b44d00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
19 changes: 6 additions & 13 deletions src/components/form/EmailField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,18 @@ const EmailField: React.FC<EmailFieldProps> = ({
validate = YupString().email(),
...otherTextFieldProps
}) => {
let {
endAdornment,
...otherInputProps
} = InputProps;

endAdornment = (
<InputAdornment position='end'>
<EmailOutlinedIcon />
</InputAdornment>
);

return (
<TextField
type='email'
name={name}
validate={validate}
InputProps={{
endAdornment,
...otherInputProps
endAdornment: (
<InputAdornment position='end'>
<EmailOutlinedIcon />
</InputAdornment>
),
...InputProps
}}
{...otherTextFieldProps}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/components/form/PasswordField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ const PasswordField: React.FC<PasswordFieldProps> = ({
name={name}
validate={validate}
InputProps={{
...InputProps,
endAdornment: (
<InputAdornment position='end'>
<SecurityIcon />
</InputAdornment>
)
),
...InputProps
}}
{...otherTextFieldProps}
/>
Expand Down

0 comments on commit 4b44d00

Please sign in to comment.