Skip to content

Commit a07ba81

Browse files
feat: tweak option styling
1 parent b98795d commit a07ba81

File tree

3 files changed

+61
-10
lines changed

3 files changed

+61
-10
lines changed

website/src/catalog/Option.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ defineProps({
2323
padding-top: 0;
2424
transition: all 0.25s;
2525
}
26+
.highlight:hover {
27+
border-color: currentColor;
28+
}
2629
.highlight {
2730
border-color: var(--vp-c-text-3);
2831
}

website/src/catalog/RuleFilter.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ watchEffect(() => {
2626
<template>
2727
<form class="filters">
2828
<details open>
29-
<summary>📚Language Filters</summary>
29+
<summary>📚Example Language</summary>
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">
@@ -36,7 +36,7 @@ watchEffect(() => {
3636
</details>
3737

3838
<details class="filter-group">
39-
<summary>📏Rule Filters</summary>
39+
<summary>📏Used Rule</summary>
4040
<div class="rule-group">
4141
<div v-for="rules, type in ruleFilters">
4242
<em style="text-transform: capitalize;">{{ type }}</em>
@@ -50,8 +50,8 @@ watchEffect(() => {
5050
</div>
5151
</details>
5252

53-
<details class="filter-group" style="display: none;">
54-
<summary>More Filters</summary>
53+
<details class="filter-group">
54+
<summary>💡More Features</summary>
5555
<div class="rule-group">
5656
<div>
5757
<em>Type</em>
@@ -80,6 +80,7 @@ watchEffect(() => {
8080
.rule-group {
8181
display: flex;
8282
margin-top: -2px;
83+
gap: 8px;
8384
}
8485
8586
.checkbox-group {
@@ -121,7 +122,6 @@ input[type="checkbox"] {
121122
}
122123
.filter-option:hover {
123124
color: var(--vp-c-brand-1);
124-
border-color: currentColor;
125125
opacity: 1;
126126
}
127127

website/src/catalog/RuleItem.vue

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,37 @@ const moreFeatures = computed(() => Math.max(meta.features.length - 2, 0))
5151
</div>
5252
</div>
5353
<div class="rule-details">
54-
<div class="rule-badges">
54+
<div class="rule-badges" >
5555
<Badge v-if="meta.type === 'Pattern'" type="info" text="Simple Pattern Example" />
5656
<template v-else>
57-
📏<span class="emoji-offset"/>
57+
<span title="Used Rules">📏</span>
58+
<span class="emoji-offset"/>
5859
<Option
5960
v-for="rule in displayedRules"
6061
:key="rule"
6162
:text="rule"
6263
:highlight="filter.selectedRuleFilters.includes(rule)"
6364
/>
64-
<Option v-if="moreRules" :text="`+${moreRules}`"/>
65+
<Option
66+
v-if="moreRules"
67+
:text="`+${moreRules}`"
68+
:data-title="meta.rules.slice(displayRuleCount).join(', ')"
69+
/>
6570
</template>
6671
</div>
6772
<div class="rule-badges" v-if="meta.features.length > 0">
68-
💡
73+
<span title="Used Features">💡</span>
6974
<Option
7075
v-for="feature in meta.features"
7176
:key="feature"
7277
:text="feature"
7378
:highlight="filter.selectedFeatures.includes(feature)"
7479
/>
75-
<Option v-if="moreFeatures" :text="`+${moreFeatures}`"/>
80+
<Option
81+
v-if="moreFeatures"
82+
:text="`+${moreFeatures}`"
83+
:data-title="meta.features.slice(2).join(', ')"
84+
/>
7685
</div>
7786
<a :href="meta.playgroundLink" class="playground link" target="_blank">
7887
Try in Playground →
@@ -162,4 +171,43 @@ a > .VPBadge:hover {
162171
.highlight-filter:hover {
163172
color: var(--vp-c-text-2);
164173
}
174+
@media only screen and (min-width: 780px) {
175+
[data-title] {
176+
position: relative;
177+
cursor: help;
178+
}
179+
[data-title]::before {
180+
position: absolute;
181+
left: 5px;
182+
bottom: -5px;
183+
width: 0;
184+
height: 0;
185+
display: block;
186+
border: 5px solid transparent;
187+
content: '';
188+
border-bottom-color: rgba(0, 0, 0, 0.5);
189+
opacity: 0;
190+
transition: 0.2s;
191+
}
192+
193+
[data-title]::after {
194+
content: attr(data-title);
195+
position: absolute;
196+
left: 50%;
197+
bottom: -5px;
198+
color: var(--vp-c-white);
199+
background-color: rgba(0, 0, 0, 0.5);
200+
padding: 0.25em 0.5em;
201+
font-size: 10px;
202+
width: max-content;
203+
transform: translate(-50%, 100%);
204+
transition: 0.2s;
205+
border-radius: 5px;
206+
opacity: 0;
207+
}
208+
209+
[data-title]:hover::after, [data-title]:hover::before {
210+
opacity: 1;
211+
}
212+
}
165213
</style>

0 commit comments

Comments
 (0)