Skip to content
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

Merged
merged 1 commit into from
May 8, 2023

Conversation

aitherios
Copy link
Contributor

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 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.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

@aitherios aitherios requested a review from a team as a code owner May 8, 2023 11:08
@github-actions github-actions bot added the search Things related to Search label May 8, 2023
@backstage-goalie
Copy link
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage/plugin-search-react plugins/search-react minor v1.6.0-next.1

@aitherios aitherios changed the title Extend InputProps on <SearchBar/> [search] Extend InputProps on <SearchBar/> May 8, 2023
}}
inputProps={{
'aria-label': ariaLabel,
...defaultInputProps,
...inputProps,
Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2023

Uffizzi Preview deployment-24577 was deleted.

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>
@aitherios aitherios force-pushed the expose-InputProps-on-SearchBar branch from d27110c to 19c0a8f Compare May 8, 2023 11:54
Copy link
Member

@emmaindal emmaindal left a 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!

@aitherios
Copy link
Contributor Author

Nice! Thank you very much!

Thank you for helping out and the quick review =]

@aitherios aitherios merged commit 1ce7f84 into master May 8, 2023
@aitherios aitherios deleted the expose-InputProps-on-SearchBar branch May 8, 2023 12:13
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2023

Thank you for contributing to Backstage! The changes in this pull request will be part of the 1.14.0 release, scheduled for Tue, 16 May 2023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
search Things related to Search
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants