fix(ui): pass custom elements and classes instead of overriding default styles

Highlight component now takes extra props for wrapping matched part of suggestion, pass span with bold text class to mark it as bold instead of overwriting default mark element with highlight class in css
This commit is contained in:
Łukasz Mierzwa
2018-08-30 23:19:44 +01:00
parent 0f3fd02fb9
commit 9384fdd42b
2 changed files with 9 additions and 7 deletions

View File

@@ -19,9 +19,3 @@ input.components-filterinput-wrapper {
input.components-filterinput-wrapper:focus {
width: auto;
}
/* highlighted part of the suggestion - phrase in the input that matches it */
mark.highlight {
padding: 0;
background-color: inherit;
}

View File

@@ -102,7 +102,15 @@ const FilterInput = observer(
};
renderSuggestion = (suggestion, { query, isHighlighted }) => {
return <Highlight search={query}>{suggestion}</Highlight>;
return (
<Highlight
matchElement="span"
matchClass="font-weight-bold"
search={query}
>
{suggestion}
</Highlight>
);
};
renderInputComponent = inputProps => {