diff --git a/src/ui/components/colors.js b/src/ui/components/colors.js index efa4f707a..21c9e4384 100644 --- a/src/ui/components/colors.js +++ b/src/ui/components/colors.js @@ -38,6 +38,7 @@ export const colors = { yellowTint: '#FEFBF2', purple: '#8C73C8', // Purple - Verbose purpleTint: '#E8E3F4', + purpleLight: '#ccc9d6', // purpleLight 90 - Highlighting row's background when it matches the query grey: '#88A2AB', // Grey - Debug greyTint: '#E7ECEE', greyTint2: '#e5e5e5', // Grey - Can be used in demarcation with greyStackTraceTint diff --git a/src/ui/components/elements-inspector/elements.js b/src/ui/components/elements-inspector/elements.js index 26fd72491..bf55449a7 100644 --- a/src/ui/components/elements-inspector/elements.js +++ b/src/ui/components/elements-inspector/elements.js @@ -26,6 +26,8 @@ const ROW_HEIGHT = 23; const backgroundColor = props => { if (props.selected) { return colors.macOSTitleBarIconSelected; + } else if (props.isQueryMatch) { + return colors.purpleLight; } else if (props.focused) { return '#00CF52'; } else if (props.even) { @@ -197,6 +199,7 @@ type ElementsRowProps = { selected: boolean, focused: boolean, matchingSearchQuery: ?string, + isQueryMatch: boolean, element: Element, even: boolean, onElementSelected: (key: ElementID) => void, @@ -353,6 +356,7 @@ class ElementsRow extends PureComponent { onDoubleClick={this.onDoubleClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} + isQueryMatch={this.props.isQueryMatch} style={style}> {line} @@ -372,6 +376,13 @@ class ElementsRow extends PureComponent { } } +function containsKeyInSearchResults( + searchResults: ?ElementSearchResultSet, + key: ElementID, +) { + return searchResults != undefined && searchResults.matches.has(key); +} + const ElementsContainer = styled(FlexColumn)({ backgroundColor: colors.white, minHeight: '100%', @@ -600,10 +611,12 @@ export class Elements extends PureComponent { selected={selected === row.key} focused={focused === row.key} matchingSearchQuery={ - searchResults && searchResults.matches.has(row.key) - ? searchResults.query + containsKeyInSearchResults(searchResults, row.key) + ? //$FlowFixMe: Checked that searchResults is not undefined in containsKeyInSearchResults + searchResults.query : null } + isQueryMatch={containsKeyInSearchResults(searchResults, row.key)} element={row.element} elements={elements} childrenCount={childrenCount}