-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[search] Extend InputProps on <SearchBar/> #17697
Conversation
Changed Packages
|
}} | ||
inputProps={{ | ||
'aria-label': ariaLabel, | ||
...defaultInputProps, | ||
...inputProps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the name from defaultInputProps
to inputProps
to avoid a clash with InputProps
capital I.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since inputProps
-> defaultInputProps
would translate the same with InputProps
.
Uffizzi Preview |
In the current implementation of <SearchBar/> it is possible to overwrite the default <TextField/> InputProps by passing a prop of the same name. But sometimes is necessary to extend only, for example when one is interested on changing the clear button only. The clear button is supplied in the endAdornment, part of the InputProps, but at the same time the startAdornment is also on it. To be able to replace the clear button implementation without affecting the rest, this patch proposes a change where `InputProps` is exposed in the same manner as `inputProps` (notice the change from capital I to i). Where the received object may overwrite keys using the spread operator. Signed-off-by: Renan Mendes Carvalho <aitherios@gmail.com>
d27110c
to
19c0a8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thank you very much!
Thank you for helping out and the quick review =] |
Thank you for contributing to Backstage! The changes in this pull request will be part of the |
Hey, I just made a Pull Request!
In the current implementation of
<SearchBar/>
it is possible to overwrite the default<TextField/>
InputProps
by passing a prop of the same name. But sometimes is necessary to extend only, for example when one is interested on changing the clear button only.The clear button is supplied in the
endAdornment
, part of theInputProps
, but at the same time thestartAdornment
is also on it. To be able to replace the clear button implementation without affecting the rest, this patch proposes a change whereInputProps
is exposed in the same manner asinputProps
(notice the change from capital I to i). Where the received object may overwrite keys using the spread operator.✔️ Checklist
Signed-off-by
line in the message. (more info)