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

Draft: Adding searchable tags to page config #1146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chriswininger
Copy link
Contributor

This will allow the component filter to better surface pages, for example a page called Alert that discusses the NxAlert component, could match on NxAlert as well as Alert.

Note: This is not quite ready yet, but pushing it up for discussion

This will allow the component filter to better surface pages, for
example a page called Alert that discusses the NxAlert component, could
match on NxAlert as well as Alert.
export function matchesFilter(filter: string, pageName: string) {
export function matchesFilter(filter: string, pageName: string, tags: string[] = []): boolean {
const matchesPageName = isStringIncludedInSecondStringCaseInsensitive(filter, pageName);
const matchesAnyTags: boolean = map((tag: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ramda has an any function that would be simpler than the map/reduce here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured it had something but struggled to figure it out, I'll poke at that

@rpokorny
Copy link
Contributor

rpokorny commented Jun 9, 2023

Approach looks good. You might want to consult with the platform designers (@platform-design on slack) about the details of how it should work. For instance I wonder if tags should match on exact strings or substrings rather than same characters in order like the page titles. I also wonder what it should look like when it matches by tag. With the page titles it bolds the characters that were matched.

@chriswininger
Copy link
Contributor Author

Approach looks good. You might want to consult with the platform designers (@platform-design on slack) about the details of how it should work. For instance I wonder if tags should match on exact strings or substrings rather than same characters in order like the page titles. I also wonder what it should look like when it matches by tag. With the page titles it bolds the characters that were matched.

yeah wondered this too, I was thinking it would be less confusing if it matched on all strings in the same way, but perhaps it should be different

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.

2 participants