watson-developer-cloud / discovery-components

IBM Watson Discovery components
https://watson-developer-cloud.github.io/discovery-components/storybook
Apache License 2.0
22 stars 38 forks source link

feat: add styling for overlapping highlights in text view #521

Closed noah-eigenfeld closed 1 year ago

noah-eigenfeld commented 1 year ago

What do these changes do/fix?

Contributes to https://github.ibm.com/Watson-Discovery/disco-issue-tracker/issues/13113 in combination with https://github.ibm.com/Watson-Discovery/discovery-tooling/pull/9903

Reworks the prop we use to take in highlights with unique colors, such that we can display overlapping highlights with their own designated color

Screenshot 2023-06-22 at 2 41 53 PM

When activating a new highlight that overlaps with several of the highlights in the first screenshot:

Screenshot 2023-06-22 at 2 41 37 PM

How do you test/verify these changes?

  1. Link components to tooling, and run locally
  2. Find a project and document where facets exist with overlapping highlights (sample project often works for me)
  3. Search for results in the above document, and toggle overlapping highlights on and off a. When overlapping highlights are both activated, the entire highlights are displayed with Carbon's Purple-50 background b. When highlights do not overlap, they retain their original colors, and the rest of highlight styling works as normal

    Have you documented your changes (if necessary)?

Are there any breaking changes included in this pull request?

The prop combinedHighlights replaces highlightedIdsByColor, which was recently added. I doubt any users have had time to start using the new, optional prop, but this would technically require them to switch to the new prop during an upgrade.

noah-eigenfeld commented 1 year ago

Only works in Text view at time of writing. Will do a little poking to see if the new prop format makes it easier to do all the styling in PDF view as well

noah-eigenfeld commented 1 year ago

Only works in Text view at time of writing. Will do a little poking to see if the new prop format makes it easier to do all the styling in PDF view as well

After a quick check, and also remembering that @dorianmiller is refactoring how styling in PDF view is handled between tooling and components, I've decided to hold off on trying to get this to work in non-text views. That work will still be tackled in https://github.ibm.com/Watson-Discovery/disco-issue-tracker/issues/16131