-
Notifications
You must be signed in to change notification settings - Fork 9
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
Highlight text matches search results #646
Highlight text matches search results #646
Conversation
Deployed to Cloudflare Pages
|
eb0387d
to
480cfd5
Compare
c2445fe
to
04a7277
Compare
04a7277
to
223c032
Compare
Friendly reminder: this is still waiting for input from @donouwens |
223c032
to
ce67ff3
Compare
Yes, please let's move forward with this. I would like to change the design a bit though: Can we not change the text color, but rather add a highlight marker/background, like in most common text highlights when searching, please? The color would be #FFFF54 - here's the visual: https://www.figma.com/file/8dwSyYOOm3vlgbvxPGT29p/Block-Explorer-(Post-Launch)?type=design&node-id=9009%3A89887&mode=design&t=gK1wSzYZ5GupHmBP-1 |
Done. (See image above) Thanks. Please note that we don't (and currently can't) do free next search inside hashes, only on token names and token symbols. (And hopefully soon in proposal names.) So that part fo the visual doesn't match reality. |
Now this has the blessing of @donouwens , so ready for review! |
9d8242b
to
8f9496f
Compare
debacb1
to
443c135
Compare
Now that proposal search is merged, I also added support for highlighting the matches in those results. |
705e4de
to
7463470
Compare
ddd39fd
to
de03474
Compare
@@ -49,7 +54,7 @@ export const TokenTitleCard: FC<{ scope: SearchScope; address: string }> = ({ sc | |||
flexWrap: 'wrap', | |||
}} | |||
> | |||
{token?.name ?? t('common.missing')} | |||
{token?.name ? <HighlightedText text={token.name} pattern={searchTerm} /> : t('common.missing')} |
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.
ah, passing searchTerm through all the layers is painful. Can later refactor so HighlightedText extracts it from URL.
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.
Indeed it's a bit of a pain. I'm not sure about the refactoring though, because there are use cases when there are multiple different highlighted terms active at the same time at the same page, coming from different sources..
1dddf40
to
5b9aacf
Compare
5b9aacf
to
c43f936
Compare
We can do this in the search results (in the example, we are searching for "gen"):