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

2580: Center search icon #2599

Merged
merged 4 commits into from
Dec 6, 2023
Merged

2580: Center search icon #2599

merged 4 commits into from
Dec 6, 2023

Conversation

Njivaniaina2407
Copy link
Contributor

Short description
The Search Icon is not centered with the input "Suche"

Proposed changes
Center and align the Search Icon with the input, set it a little lower

Side effects
Resolved issues
The Search Icon is aligned with the Input "Suche"

Fixes: #2580


@Njivaniaina2407 Njivaniaina2407 changed the title 2580: add a 'top' to the search icon and search icon centered 2580: Center search icon Nov 28, 2023
Copy link
Contributor

@LeandraH LeandraH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That solves the issue here very nicely, thank you! But I think we can make the code more future-proof by setting the parent display to flex and aligning its items with the center. That would also keep us safe in case we e.g. change the icon sizing at some point.

@f1sh1918
Copy link
Contributor

f1sh1918 commented Dec 4, 2023

That solves the issue here very nicely, thank you! But I think we can make the code more future-proof by setting the parent display to flex and aligning its items with the center. That would also keep us safe in case we e.g. change the icon sizing at some point.

sorry i probably should have mentioned it again in the ticket here. This task was about learning sth. about flexbox :)
Just some background behind that @Njivaniaina2407
If you are setting the icon pixelwise to a position and the icon size may change or the size of the container may change it will not be centered anymore. That's why its better to use flexbox that centers the item depending on the parent

@Njivaniaina2407
Copy link
Contributor Author

I've modified the code and aligned the icon to center from the div parent

Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Work :) Added a comment about inline-flex

web/src/components/SearchInput.tsx Outdated Show resolved Hide resolved
Co-authored-by: Andreas Fischer <37902063+f1sh1918@users.noreply.github.com>
Copy link
Contributor

@LeandraH LeandraH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

@Njivaniaina2407 Njivaniaina2407 merged commit fd88e61 into main Dec 6, 2023
8 checks passed
@Njivaniaina2407 Njivaniaina2407 deleted the 2580-2-center-search-icon branch December 6, 2023 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search Icon not centered
3 participants