Skip to content

Commit 539be46

Browse files
feat: update filter color
1 parent 058d518 commit 539be46

File tree

6 files changed

+54
-36
lines changed

6 files changed

+54
-36
lines changed

website/.vitepress/theme/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
}
1515
.dark {
1616
--vp-custom-selector-option-text: #213547;
17-
}
17+
}

website/src/catalog/Option.vue

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,22 @@ defineProps({
1212
</template>
1313

1414
<style scoped>
15-
code.option {
16-
cursor: pointer;
17-
filter: saturate(0);
18-
opacity: 0.8;
15+
.option {
16+
color: var(--vp-c-text-2);
1917
user-select: none;
2018
border: 1px solid transparent;
21-
min-width: 3em;
2219
display: inline-block;
2320
height: 24px;
2421
line-height: 24px;
2522
text-align: center;
2623
padding-top: 0;
27-
}
28-
code.option:hover {
29-
opacity: 1;
30-
filter: saturate(1);
24+
transition: all 0.25s;
3125
}
3226
.highlight {
33-
color: var(--vp-c-brand-1);
27+
color: var(--catalog-filter-color);
28+
border-color: var(--catalog-filter-color);
3429
}
3530
.highlight-filter:hover {
36-
color: var(--vp-c-brand-1);
31+
color: var(--catalog-filter-color);
3732
}
3833
</style>

website/src/catalog/RuleFilter.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ watchEffect(() => {
3030
<div class="checkbox-group">
3131
<label v-for="displayName, lang in languages" :key="lang">
3232
<input type="checkbox" v-model="filter.selectedLanguages" :value="lang">
33-
<Option :text="displayName"/>
33+
<Option :text="displayName" class="filter-option"/>
3434
</label>
3535
</div>
3636
</details>
@@ -43,7 +43,7 @@ watchEffect(() => {
4343
<div class="checkbox-group">
4444
<label v-for="rule in rules" :key="rule">
4545
<input type="checkbox" v-model="filter.selectedRuleFilters" :value="rule">
46-
<Option :text="rule"/>
46+
<Option :text="rule" class="filter-option"/>
4747
</label>
4848
</div>
4949
</div>
@@ -58,7 +58,7 @@ watchEffect(() => {
5858
<div class="checkbox-group">
5959
<label v-for="type in ruleTypes" :key="type">
6060
<input type="checkbox" v-model="filter.selectedTypes" :value="type">
61-
<Option :text="type"/>
61+
<Option :text="type" class="filter-option"/>
6262
</label>
6363
</div>
6464
</div>
@@ -67,7 +67,7 @@ watchEffect(() => {
6767
<div class="checkbox-group">
6868
<label v-for="feature in features" :key="feature">
6969
<input type="checkbox" v-model="filter.selectedFeatures" :value="feature">
70-
<Option :text="feature"/>
70+
<Option :text="feature" class="filter-option"/>
7171
</label>
7272
</div>
7373
</div>
@@ -85,7 +85,7 @@ watchEffect(() => {
8585
.checkbox-group {
8686
margin-top: 0.2em;
8787
display: flex;
88-
gap: 5px;
88+
gap: 4px;
8989
}
9090
9191
label {
@@ -114,9 +114,19 @@ input[type="checkbox"] {
114114
display: none;
115115
}
116116
117+
.filter-option {
118+
cursor: pointer;
119+
opacity: 0.8;
120+
min-width: 3em;
121+
}
122+
.filter-option:hover {
123+
opacity: 1;
124+
color: var(--catalog-filter-color);
125+
}
126+
117127
input[type="checkbox"]:checked + code.option {
118-
filter: saturate(1);
119128
opacity: 1;
129+
color: var(--catalog-filter-color);
120130
border-color: currentColor;
121131
}
122132

website/src/catalog/RuleItem.vue

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script setup lang="ts">
2-
import { type RuleMeta, type Filter, languages } from './data'
32
import { type PropType, computed } from 'vue'
43
4+
import { type RuleMeta, type Filter, languages } from './data'
5+
import Option from './Option.vue'
6+
57
const { meta } = defineProps({
68
meta: {
79
type: Object as PropType<RuleMeta>,
@@ -41,24 +43,26 @@ const moreFeatures = computed(() => Math.max(meta.features.length - 2, 0))
4143
<Badge v-if="meta.type === 'Pattern'" type="info" text="Simple Pattern Example" />
4244
<template v-else>
4345
📏<span class="emoji-offset"/>
44-
<code class="used" v-for="rule in displayedRules" :class="filter.selectedRuleFilters.includes(rule) && 'highlight-filter'">
45-
{{ rule }}
46-
</code>
47-
<code class="used" v-if="moreRules">
48-
+{{ moreRules }}
49-
</code>
46+
<Option
47+
v-for="rule in displayedRules"
48+
:key="rule"
49+
:text="rule"
50+
:highlight="filter.selectedRuleFilters.includes(rule)"
51+
/>
52+
<Option v-if="moreRules" :text="`+${moreRules}`"/>
5053
</template>
5154
</div>
5255
<div class="rule-badges" v-if="meta.features.length > 0">
5356
💡
54-
<code class="used" v-for="feature in meta.features">
55-
{{ feature }}
56-
</code>
57-
<code class="used" v-if="moreFeatures">
58-
+{{ moreFeatures }}
59-
</code>
57+
<Option
58+
v-for="feature in meta.features"
59+
:key="feature"
60+
:text="feature"
61+
:highlight="filter.selectedFeatures.includes(feature)"
62+
/>
63+
<Option v-if="moreFeatures" :text="`+${moreFeatures}`"/>
6064
</div>
61-
<a :href="meta.playgroundLink" class="link playground" target="_blank">
65+
<a :href="meta.playgroundLink" class="playground" target="_blank">
6266
Try in Playground →
6367
</a>
6468
</div>
@@ -137,10 +141,10 @@ a:hover {
137141
transition-duration: 0.25s;
138142
}
139143
.highlight-filter {
140-
color: var(--vp-c-brand-1);
141-
border-color: var(--vp-c-brand-1);
144+
color: var(--catalog-filter-color);
145+
border-color: var(--catalog-filter-color);
142146
}
143147
.highlight-filter:hover {
144-
color: var(--vp-c-brand-1);
148+
color: var(--catalog-filter-color);
145149
}
146150
</style>

website/src/catalog/RuleList.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ const ruleMetaData = computed(() => getRuleMetaData(props.filter))
1717
<h3>Rule List</h3>
1818
<br/>
1919
<TransitionGroup class="rule-list" tag="ul">
20-
<RuleItem v-for="meta in ruleMetaData" :key="meta.language + meta.id" :meta="meta" :filter="filter"/>
20+
<RuleItem
21+
v-for="meta in ruleMetaData"
22+
:key="meta.language + meta.id"
23+
:meta="meta"
24+
:filter="filter"
25+
/>
2126
</TransitionGroup>
2227
</template>
2328

website/src/catalog/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ const filter = ref<Filter>({
2020
</template>
2121

2222
<style scoped>
23+
.catalog-filter {
24+
min-height: 300px;
25+
--catalog-filter-color: #407cb5;
26+
}
2327
</style>

0 commit comments

Comments
 (0)