1
1
<script setup lang="ts">
2
- import { watchEffect , ref } from ' vue'
2
+ import { ref , watchEffect } from ' vue'
3
+ import { features , type Filter , languages , ruleFilters , ruleTypes } from ' ./data'
3
4
import Option from ' ./Option.vue'
4
- import {
5
- languages ,
6
- ruleFilters ,
7
- features ,
8
- ruleTypes ,
9
- type Filter ,
10
- } from ' ./data'
11
5
12
6
const model = defineModel <Filter >()
13
7
@@ -25,29 +19,28 @@ watchEffect(() => {
25
19
watchEffect (() => {
26
20
filter .value = model .value !
27
21
})
28
-
29
22
</script >
30
23
<template >
31
24
<form class =" filters" >
32
25
<details open >
33
26
<summary >📚 Example Language</summary >
34
27
<div class =" checkbox-group" >
35
- <label v-for =" displayName, lang in languages" :key =" lang" >
28
+ <label v-for =" ( displayName, lang) in languages" :key =" lang" >
36
29
<input type =" checkbox" v-model =" filter.selectedLanguages" :value =" lang" >
37
- <Option :text =" displayName" class =" filter-option" />
30
+ <Option :text =" displayName" class =" filter-option" />
38
31
</label >
39
32
</div >
40
33
</details >
41
34
42
35
<details open >
43
36
<summary >📏 Used Rule</summary >
44
37
<div class =" filter-group rule-filter-group" >
45
- <div v-for =" rules, type in ruleFilters" >
46
- <em style =" text-transform : capitalize ; " >{{ type }}</em >
38
+ <div v-for =" ( rules, type) in ruleFilters" >
39
+ <em style =" text-transform : capitalize " >{{ type }}</em >
47
40
<div class =" checkbox-group" >
48
41
<label v-for =" rule in rules" :key =" rule" >
49
42
<input type =" checkbox" v-model =" filter.selectedRules" :value =" rule" >
50
- <Option :text =" rule" class =" filter-option" />
43
+ <Option :text =" rule" class =" filter-option" />
51
44
</label >
52
45
</div >
53
46
</div >
@@ -56,7 +49,7 @@ watchEffect(() => {
56
49
<div class =" checkbox-group" >
57
50
<label v-for =" type in ruleTypes" :key =" type" >
58
51
<input type =" checkbox" v-model =" filter.selectedTypes" :value =" type" >
59
- <Option :text =" type" class =" filter-option" />
52
+ <Option :text =" type" class =" filter-option" />
60
53
</label >
61
54
</div >
62
55
</div >
@@ -71,7 +64,7 @@ watchEffect(() => {
71
64
<div class =" checkbox-group" >
72
65
<label v-for =" feature in features" :key =" feature" >
73
66
<input type =" checkbox" v-model =" filter.selectedFeatures" :value =" feature" >
74
- <Option :text =" feature" class =" filter-option" />
67
+ <Option :text =" feature" class =" filter-option" />
75
68
</label >
76
69
</div >
77
70
</div >
@@ -150,11 +143,11 @@ input[type="checkbox"]:checked + code.option:hover {
150
143
151
144
@keyframes details-show {
152
145
from {
153
- opacity :0 ;
146
+ opacity : 0 ;
154
147
transform : translateY (-0.5em );
155
148
}
156
149
}
157
150
details [open ] > * :not (summary ) {
158
151
animation : details-show 0.2s ease-in-out ;
159
152
}
160
- </style >
153
+ </style >
0 commit comments