File tree Expand file tree Collapse file tree 3 files changed +27
-50
lines changed
Expand file tree Collapse file tree 3 files changed +27
-50
lines changed Original file line number Diff line number Diff line change 11<script setup>
2+ import { BADGE_TYPES } from ' #shared/utils/badges'
23import { useClipboard } from ' @vueuse/core'
34
45const pkg = useState (' badge-pkg' , () => ' nuxt' )
@@ -7,30 +8,6 @@ const isValid = ref(true)
78
89const { copy , copied } = useClipboard ({ copiedDuring: 2000 })
910
10- const types = [
11- ' version' ,
12- ' license' ,
13- ' size' ,
14- ' downloads' ,
15- ' downloads-day' ,
16- ' downloads-week' ,
17- ' downloads-month' ,
18- ' downloads-year' ,
19- ' vulnerabilities' ,
20- ' dependencies' ,
21- ' created' ,
22- ' updated' ,
23- ' engines' ,
24- ' types' ,
25- ' maintainers' ,
26- ' deprecated' ,
27- ' quality' ,
28- ' popularity' ,
29- ' maintenance' ,
30- ' score' ,
31- ' name' ,
32- ]
33-
3411watch ([pkg, type], () => {
3512 isValid .value = true
3613})
@@ -76,7 +53,7 @@ const copyToClipboard = async () => {
7653 v-model =" type"
7754 class =" w-full h-10.5 px-4 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-black/20 focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500 outline-none text-sm transition-all appearance-none cursor-pointer"
7855 >
79- <option v-for =" t in types " :key =" t" :value =" t" class =" dark:bg-gray-900" >
56+ <option v-for =" t in BADGE_TYPES " :key =" t" :value =" t" class =" dark:bg-gray-900" >
8057 {{ formatLabel(t) }}
8158 </option >
8259 </select >
Original file line number Diff line number Diff line change 11<script setup>
2+ import { BADGE_TYPES } from ' #shared/utils/badges'
23import { useClipboard } from ' @vueuse/core'
34
45const pkg = useState (' badge-pkg' , () => ' nuxt' )
@@ -14,30 +15,6 @@ const badgeColor = useState('badge-color', () => '')
1415const usePkgName = useState (' badge-use-name' , () => false )
1516const badgeStyle = useState (' badge-style' , () => ' default' )
1617
17- const types = [
18- ' version' ,
19- ' license' ,
20- ' size' ,
21- ' downloads' ,
22- ' downloads-day' ,
23- ' downloads-week' ,
24- ' downloads-month' ,
25- ' downloads-year' ,
26- ' vulnerabilities' ,
27- ' dependencies' ,
28- ' created' ,
29- ' updated' ,
30- ' engines' ,
31- ' types' ,
32- ' maintainers' ,
33- ' deprecated' ,
34- ' quality' ,
35- ' popularity' ,
36- ' maintenance' ,
37- ' score' ,
38- ' name' ,
39- ]
40-
4118const styles = [' default' , ' shieldsio' ]
4219
4320const validateHex = hex => {
@@ -122,7 +99,7 @@ const copyToClipboard = async () => {
12299 v- model= " type"
123100 class = " w-full h-10.5 px-4 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-black/20 focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500 outline-none text-sm transition-all appearance-none cursor-pointer"
124101 >
125- < option v- for = " t in types " : key= " t" : value= " t" class = " dark:bg-gray-900" >
102+ < option v- for = " t in BADGE_TYPES " : key= " t" : value= " t" class = " dark:bg-gray-900" >
126103 {{ formatLabel (t) }}
127104 < / option>
128105 < / select>
Original file line number Diff line number Diff line change 1+ export const BADGE_TYPES = Object . freeze ( [
2+ 'version' ,
3+ 'license' ,
4+ 'size' ,
5+ 'downloads' ,
6+ 'downloads-day' ,
7+ 'downloads-week' ,
8+ 'downloads-month' ,
9+ 'downloads-year' ,
10+ 'vulnerabilities' ,
11+ 'dependencies' ,
12+ 'created' ,
13+ 'updated' ,
14+ 'engines' ,
15+ 'types' ,
16+ 'maintainers' ,
17+ 'deprecated' ,
18+ 'quality' ,
19+ 'popularity' ,
20+ 'maintenance' ,
21+ 'score' ,
22+ 'name' ,
23+ ] as const )
You can’t perform that action at this time.
0 commit comments