Skip to content

Commit

Permalink
refactor: replace class binding with inline style for focus color in …
Browse files Browse the repository at this point in the history
…OverlapCard, RuleCard, and SearchCard
  • Loading branch information
lisonge committed Nov 8, 2024
1 parent 9469730 commit 878d466
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/views/snapshot/OverlapCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const left = _1vw * 25.5;
:key="resultNode.id"
@click="snapshotStore.updateFocusNode(resultNode)"
size="small"
:class="{ 'color-[#00F]': resultNode === focusNode }"
:style="{
color: resultNode === focusNode ? '#00F' : undefined,
}"
>
{{ getNodeLabel(resultNode) }}
</NButton>
Expand Down
4 changes: 2 additions & 2 deletions src/views/snapshot/RuleCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ const targetNode = computed(() => {
v-else-if="targetNode"
@click="snapshotStore.updateFocusNode(targetNode)"
size="small"
:class="{
'color-[#00F]': targetNode === focusNode,
:style="{
color: targetNode === focusNode ? '#00F' : undefined,
}"
>
{{ getNodeLabel(targetNode) }}
Expand Down
12 changes: 8 additions & 4 deletions src/views/snapshot/SearchCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ const shareResult = (result: SearchResult) => {
:key="resultNode.id"
@click="updateFocusNode(resultNode)"
size="small"
:class="{ 'color-[#00F]': resultNode === focusNode }"
:style="{
color: resultNode === focusNode ? '#00F' : undefined,
}"
>
{{ getNodeLabel(resultNode) }}
</NButton>
Expand Down Expand Up @@ -406,9 +408,11 @@ const shareResult = (result: SearchResult) => {
updateFocusNode(trackNodes[result.selector.targetIndex])
"
size="small"
:class="{
'color-[#00F]':
trackNodes[result.selector.targetIndex] === focusNode,
:style="{
color:
trackNodes[result.selector.targetIndex] === focusNode
? '#00F'
: undefined,
}"
>
{{ getNodeLabel(trackNodes[result.selector.targetIndex]) }}
Expand Down

0 comments on commit 878d466

Please sign in to comment.