omniboxresult: add catch for dojo's graphic

This commit is contained in:
Matilde Park 2020-07-30 19:17:17 -04:00
parent 1be4aed640
commit 1c567ad4d9

View File

@ -18,13 +18,26 @@ export class OmniboxResult extends Component {
render() {
const { icon, text, subtext, link, navigate, selected, dark } = this.props;
const invertGraphic = ((!dark && this.state.hovered || selected === link) || (dark && !(this.state.hovered || selected === link)))
? { filter: 'invert(1)' }
: { filter: 'invert(0)' };
let invertGraphic = {};
if (icon.toLowerCase() !== 'dojo') {
invertGraphic = (!dark && this.state.hovered) ||
selected === link ||
(dark && !(this.state.hovered || selected === link))
? { filter: "invert(1)" }
: { filter: "invert(0)" };
} else {
invertGraphic =
(!dark && this.state.hovered) ||
selected === link ||
(dark && !(this.state.hovered || selected === link))
? { filter: "invert(0)" }
: { filter: "invert(1)" };
}
let graphic = <div />;
if (defaultApps.includes(icon.toLowerCase())) {
graphic = <img className="invert-d mr2 v-mid" height="12" width="12" src={`/~landscape/img/${icon.toLowerCase()}.png`} style={invertGraphic} />;
graphic = <img className="mr2 v-mid" height="12" width="12" src={`/~landscape/img/${icon.toLowerCase()}.png`} style={invertGraphic} />;
} else {
graphic = <Icon />;
}