Replaced nested ternary

This commit is contained in:
Brian Vaughn
2019-04-10 10:01:03 -07:00
parent 6836f15924
commit caa74472f2
2 changed files with 11 additions and 10 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
.Element,
.SelectedElement,
.InactiveElement {
.InactiveSelectedElement,
.SelectedElement {
border-radius: 0.25em;
white-space: nowrap;
line-height: var(--line-height-data);
@@ -14,7 +14,7 @@
.Element:hover {
background-color: var(--color-hover-background);
}
.InactiveElement {
.InactiveSelectedElement {
background-color: var(--color-inactive-background);
}
+8 -7
View File
@@ -116,15 +116,16 @@ export default function ElementView({ data, index, style }: Props) {
const showDollarR =
isSelected && (type === ElementTypeClass || type === ElementTypeFunction);
let className = styles.Element;
if (isSelected) {
className = treeFocused
? styles.SelectedElement
: styles.InactiveSelectedElement;
}
return (
<div
className={
isSelected && treeFocused
? styles.SelectedElement
: isSelected
? styles.InactiveElement
: styles.Element
}
className={className}
onMouseEnter={handleMouseEnter}
onMouseDown={handleMouseDown}
onDoubleClick={handleDoubleClick}