|
1 | 1 | <script setup lang="ts"> |
2 | | -import { NuxtLink } from '#components' |
| 2 | +import { ButtonLink, TagStatic } from '#components' |
3 | 3 |
|
4 | 4 | const props = defineProps<{ |
5 | 5 | packageName: string |
@@ -56,62 +56,42 @@ const typesHref = computed(() => { |
56 | 56 | <!-- TypeScript types badge --> |
57 | 57 | <li v-if="!props.isBinary"> |
58 | 58 | <TooltipApp :text="typesTooltip"> |
59 | | - <component |
60 | | - :is="typesHref ? NuxtLink : 'span'" |
61 | | - :to="typesHref" |
62 | | - :tabindex="!typesHref ? 0 : undefined" |
63 | | - class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200" |
64 | | - :class="[ |
65 | | - hasTypes |
66 | | - ? 'text-fg-muted bg-bg-muted border border-border' |
67 | | - : 'text-fg-subtle bg-bg-subtle border border-border-subtle', |
68 | | - typesHref |
69 | | - ? 'hover:text-fg hover:border-border-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50' |
70 | | - : '', |
71 | | - ]" |
72 | | - > |
| 59 | + <ButtonLink v-if="typesHref" variant="tag" :to="typesHref"> |
| 60 | + <span class="w-3 h-3 i-carbon-checkmark" aria-hidden="true" /> |
| 61 | + {{ $t('package.metrics.types_label') }} |
| 62 | + </ButtonLink> |
| 63 | + <TagStatic v-else :variant="hasTypes ? 'default' : 'disabled'" :tabindex="0"> |
73 | 64 | <span |
74 | 65 | class="w-3 h-3" |
75 | 66 | :class="hasTypes ? 'i-carbon-checkmark' : 'i-carbon-close'" |
76 | 67 | aria-hidden="true" |
77 | 68 | /> |
78 | 69 | {{ $t('package.metrics.types_label') }} |
79 | | - </component> |
| 70 | + </TagStatic> |
80 | 71 | </TooltipApp> |
81 | 72 | </li> |
82 | 73 |
|
83 | 74 | <!-- ESM badge (show with X if missing) --> |
84 | 75 | <li> |
85 | 76 | <TooltipApp :text="hasEsm ? $t('package.metrics.esm') : $t('package.metrics.no_esm')"> |
86 | | - <span |
87 | | - tabindex="0" |
88 | | - class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200" |
89 | | - :class=" |
90 | | - hasEsm |
91 | | - ? 'text-fg-muted bg-bg-muted border border-border' |
92 | | - : 'text-fg-subtle bg-bg-subtle border border-border-subtle' |
93 | | - " |
94 | | - > |
| 77 | + <TagStatic tabindex="0" :variant="hasEsm ? 'default' : 'disabled'"> |
95 | 78 | <span |
96 | 79 | class="w-3 h-3" |
97 | 80 | :class="hasEsm ? 'i-carbon-checkmark' : 'i-carbon-close'" |
98 | 81 | aria-hidden="true" |
99 | 82 | /> |
100 | 83 | ESM |
101 | | - </span> |
| 84 | + </TagStatic> |
102 | 85 | </TooltipApp> |
103 | 86 | </li> |
104 | 87 |
|
105 | 88 | <!-- CJS badge (only show if present) --> |
106 | 89 | <li v-if="hasCjs"> |
107 | 90 | <TooltipApp :text="$t('package.metrics.cjs')"> |
108 | | - <span |
109 | | - tabindex="0" |
110 | | - class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs text-fg-muted bg-bg-muted border border-border rounded transition-colors duration-200" |
111 | | - > |
| 91 | + <TagStatic tabindex="0"> |
112 | 92 | <span class="i-carbon-checkmark w-3 h-3" aria-hidden="true" /> |
113 | 93 | CJS |
114 | | - </span> |
| 94 | + </TagStatic> |
115 | 95 | </TooltipApp> |
116 | 96 | </li> |
117 | 97 | </ul> |
|
0 commit comments