-
Notifications
You must be signed in to change notification settings - Fork 531
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
feat(highlight): add cssClasses to snippet & highlight helper #4306
Conversation
This is related to: algolia/vue-instantsearch#759. Just adding this doesn't totally solve the situation yet, but it at least allows a hook for adding extra class names. What's interesting to note is that the suit helper in InstantSearch only concatenates names, and thus the keys for cssClasses are just the modifier. In Vue InstantSearch the keys for classNames are the generated classes, since the suit helper will check those keys directly. I wonder if we could move to such a system in InstantSearch.js in the future. This will allow us to remove these mappings, and deal with it at call site (which likely has a decrease in bundle size)
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.
We'll need to increase bundlesize's threshold.
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.
looks good to me (as long as you add a commit to increase bundlesize's threshold)
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.
Good once the size threshold is increased.
This is related to: algolia/vue-instantsearch#759. Just adding this doesn't totally solve the situation yet, but it at least allows a hook for adding extra class names.
What's interesting to note is that the suit helper in InstantSearch only concatenates names, and thus the keys for cssClasses are just the modifier. In Vue InstantSearch the keys for classNames are the generated classes, since the suit helper will check those keys directly. I wonder if we could move to such a system in InstantSearch.js in the future. This will allow us to remove these mappings, and deal with it at call site (which likely has a decrease in bundle size)
Summary
Before this change, it was impossible to override class names for the highlighted part of an ais-highlight.
Result
A new
cssClasses
option to the highlight helper, which accepts a keyhighlighted
.