Skip to content

Commit

Permalink
Highlight patterns without matches in red
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 6, 2024
1 parent abf2f94 commit af89092
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion assets/vue/RecentPatterns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div class="recent-pattern-source">
<table class="pattern">
<tbody>
<tr v-for="line in pattern.lines" :key="line.num">
<tr v-for="line in pattern.lines" :key="line.num" :class="getClassForPattern(pattern)">
<td class="linenumber">{{ line.num }}</td>
<td class="code">{{ line.text }}</td>
</tr>
Expand Down Expand Up @@ -119,6 +119,12 @@ export default {
window.removeEventListener('scroll', this.handleScroll);
},
methods: {
getClassForPattern(pattern) {
return {
'pattern-without-matches': pattern.matches === 0,
'pattern-with-matches': pattern.matches > 0
};
},
async getPatterns() {
const query = this.params;
const ua = new UserAgent({baseURL: window.location.href});
Expand Down Expand Up @@ -232,4 +238,10 @@ export default {
color: rgba(27, 31, 35, 0.3);
user-select: none;
}
.pattern-with-matches {
background-color: #ffffff;
}
.pattern-without-matches {
background-color: #ffebe9;
}
</style>

0 comments on commit af89092

Please sign in to comment.