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 unique highlighting colors to document preview text view #517

Closed noah-eigenfeld closed 1 year ago

noah-eigenfeld commented 1 year ago

What do these changes do/fix?

Adds a new, optional prop highlightedIdsByColor to the CIDocumentContent component, which lets us pass in specific colors for groups of highlights.

Related issue: https://github.ibm.com/Watson-Discovery/disco-issue-tracker/issues/13111 Related PR: https://github.ibm.com/Watson-Discovery/discovery-tooling/pull/9846

How do you test/verify these changes?

  1. For easiest testing, you'll want to link with tooling on the branch for https://github.ibm.com/Watson-Discovery/discovery-tooling/pull/9846
  2. Make a query in a project with results you can view in text view (PDFs, for example)
  3. Open the Advanced Preview for a result
  4. Select some highlight facets. You should see: a. Each new highlight added gets its own unique color b. There is a set of default colors (from the linked issue above) that are assigned first, followed by random colors c. Selected colors are all light enough that you can read the black text on them d. Deselecting a facet that had one of the default colors opens that color to be used by the next selected facet

    Have you documented your changes (if necessary)?

Are there any breaking changes included in this pull request?

No, since I left the original highlightedIds prop in place and made this a new, optional prop that overrides the old one