Skip to content

Conversation

martenbjork
Copy link
Contributor

@martenbjork martenbjork commented Jul 5, 2022

Cleans up the code that powers the global search. The new code is still complex, but less so. Implementing new types of search results is also easier thanks to the simpler useGlobalSearchResults() hook.

UX updates

This refactor shouldn't change the search experience much. One update however, is that foundations results now render with the correct icon / color.

image

Related to #6529, this PR also increases the number of search results that are visible for each category, which fixes #6546.

Also fixes #6463.

@martenbjork martenbjork changed the title [polaris.shopify.com] Clean up search result types [polaris.shopify.com] Clean up search results Jul 5, 2022
@martenbjork martenbjork changed the title [polaris.shopify.com] Clean up search results [polaris.shopify.com][WIP] Clean up search results Jul 5, 2022
@alex-page alex-page force-pushed the main branch 7 times, most recently from a3a40bb to 0281d22 Compare July 14, 2022 05:31
@martenbjork martenbjork changed the title [polaris.shopify.com][WIP] Clean up search results [polaris.shopify.com] Clean up search results (ready for review) Jul 19, 2022
@martenbjork martenbjork changed the title [polaris.shopify.com] Clean up search results (ready for review) [polaris.shopify.com] Refactor search results (ready for review) Jul 20, 2022
@martenbjork martenbjork changed the title [polaris.shopify.com] Refactor search results (ready for review) [polaris.shopify.com] Refactor site search (ready for review) Jul 20, 2022
},
"intro": "Our mission is to make commerce better for _everyone_. Building products for everyone means creating inclusive content.",
"section": "content"
"category": "content"
Copy link
Member

Choose a reason for hiding this comment

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

Love the consolidation here. I was unsure why it's called content but this is fine for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The category maps to the folder that the foundations content lives in: foundations | design | content | patterns.

Comment on lines +19 to +22
components: "Components",
foundations: "Foundations",
tokens: "Tokens",
icons: "Icons",
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this? Could just be uppercase the key function

Copy link
Contributor Author

@martenbjork martenbjork Jul 21, 2022

Choose a reason for hiding this comment

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

I know, it was tempting to remove this very verbose part of the code. It just feels icky to hide the translations strings and make assumptions about language. If we add a more complex search result type like, GitHub repos, it's nice to be able to be explicit about capitalization.

@martenbjork martenbjork merged commit ef46503 into main Jul 21, 2022
@martenbjork martenbjork deleted the search-cleanup-redux branch July 21, 2022 09:33
This was referenced Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants