mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: ✨ Add Enum preference type support
This commit is contained in:
parent
ca824a2a1a
commit
dca7af4b0e
10 changed files with 149 additions and 4 deletions
46
components/preferences/select.vue
Normal file
46
components/preferences/select.vue
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<Card class="grid grid-cols-[1fr,auto] items-center p-6 gap-2">
|
||||
<CardHeader class="space-y-0.5 p-0">
|
||||
<CardTitle class="text-base">
|
||||
{{ setting.title }}
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
{{ setting.description }}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardFooter class="p-0">
|
||||
<Select :model-value="setting.value" @update:model-value="v => { setting.value = v }">
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select an option" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="option of setting.options" :value="option.value">
|
||||
{{ option.label }}
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
Card,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "~/components/ui/card";
|
||||
import type { EnumSetting } from "~/settings.ts";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "../ui/select";
|
||||
|
||||
defineModel<EnumSetting>("setting", {
|
||||
required: true,
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<Card class="grid grid-cols-[1fr,auto] items-center p-6">
|
||||
<Card class="grid grid-cols-[1fr,auto] items-center p-6 gap-2">
|
||||
<CardHeader class="space-y-0.5 p-0">
|
||||
<CardTitle class="text-base">
|
||||
{{ setting.title }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue