refactor(ui): raw buttons, details and hr use Button, Collapsible and Separator

This commit is contained in:
sam committed 2026-10-26 20:00:57 +11:00
1 parent 57c8514d5f
commit acf9ce2cd5
32 files changed
+138 -152

No files matched your search

+3 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { computed } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
@@ -27,9 +28,9 @@ const title = computed(() => store.catalog.find((item) => item.kind === props.ki
<template>
<Popover v-if="problems.length && compact">
<PopoverTrigger as-child>
<button type="button" class="rounded-sm" :aria-label="`Apply status: ${applyStateLabel(problems[0]!.state, mode)}`">
<Button type="button" variant="ghost" class="h-auto rounded-sm p-0" :aria-label="`Apply status: ${applyStateLabel(problems[0]!.state, mode)}`">
<Badge :variant="applyStateTone(problems[0]!.state, mode)">{{ applyStateLabel(problems[0]!.state, mode) }}</Badge>
</button>
</Button>
</PopoverTrigger>
<PopoverContent align="end" class="w-80">
<ApplyStatusRows :kind="kind" />
+5 -5
View File
@@ -178,15 +178,15 @@ const tones = {
<TabsContent value="marketplace">
<p v-if="store.catalogueError" class="text-sm text-fg-muted">{{ store.catalogueError }}</p>
<ExtensionsMarketplace v-else :updates="updates" />
<details class="mt-3">
<summary class="cursor-pointer text-xs text-fg-muted">Install by reference</summary>
<form class="mt-2 flex flex-wrap gap-2" @submit.prevent="install">
<Collapsible class="mt-3">
<CollapsibleTrigger class="cursor-pointer text-xs text-fg-muted">Install by reference</CollapsibleTrigger>
<CollapsibleContent><form class="mt-2 flex flex-wrap gap-2" @submit.prevent="install">
<Input v-model="name" class="max-w-40" placeholder="Name" aria-label="Name" required />
<Input v-model="reference" class="max-w-80 font-mono" placeholder="registry/repo:tag" aria-label="Reference" required />
<Input v-model="digest" class="max-w-96 font-mono" placeholder="sha256:…" aria-label="Digest" required />
<Button type="submit" size="sm" :disabled="!!store.busy"><Plus data-icon="inline-start" />Install</Button>
</form>
</details>
</form></CollapsibleContent>
</Collapsible>
</TabsContent>
</Tabs>
+3 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { computed, onMounted, onUnmounted, ref } from "vue";
import { ChevronDown } from "@lucide/vue";
@@ -122,9 +123,9 @@ onUnmounted(() => clearInterval(timer));
<template v-if="row.state !== 'up'">
<Popover v-if="reasons(row).length">
<PopoverTrigger as-child>
<button type="button" class="rounded-sm" :aria-label="`Why ${row.service} is ${row.state}`">
<Button type="button" variant="ghost" class="h-auto rounded-sm p-0" :aria-label="`Why ${row.service} is ${row.state}`">
<Badge :variant="tone[row.state]">{{ stateLabel(row, table.agent) }}<ChevronDown data-icon="inline-end" /></Badge>
</button>
</Button>
</PopoverTrigger>
<PopoverContent align="start" class="w-96 max-w-[calc(100vw-2rem)] space-y-1 text-sm">
<p v-for="reason in reasons(row)" :key="reason" class="break-words">{{ reason }}</p>
+2 -1
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Separator } from "@/components/ui/separator";
import { computed } from "vue";
import { useRoute } from "vue-router";
@@ -33,7 +34,7 @@ const items = computed(() =>
>
<ul class="flex flex-col gap-0.5 lg:sticky lg:top-20 max-lg:flex-row max-lg:gap-1">
<li v-for="(item, index) in items" :key="item.path" class="contents">
<hr v-if="item.dividerBefore === ''" class="my-4 border-border max-lg:hidden" />
<Separator v-if="item.dividerBefore === ''" class="my-4 max-lg:hidden" />
<p
v-else-if="item.dividerBefore"
:class="cn('mb-1 px-3 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase max-lg:hidden', index > 0 && 'mt-4')"