shadcn-vue/apps/www/.vitepress/theme/components/StyleSwitcher.vue
2023-09-13 00:32:12 +08:00

32 lines
923 B
Vue

<script setup lang="ts">
import { type SelectTriggerProps } from 'radix-vue'
import { useConfigStore } from '@/stores/config'
import { cn } from '@/lib/utils'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/lib/registry/new-york/ui/select'
import { styles } from '@/lib/registry/styles'
const props = defineProps<SelectTriggerProps & { class?: string }>()
const { config } = useConfigStore()
</script>
<template>
<Select v-model="config.style">
<SelectTrigger :class="cn('h-7 w-[145px] text-xs [&_svg]:h-4 [&_svg]:w-4', props.class)">
<span class="text-muted-foreground">Style: </span>
<SelectValue placeholder="Select style" />
</SelectTrigger>
<SelectContent>
<SelectItem v-for="style in styles" :key="style.name" :value="style.name" class="text-xs">
{{ style.label }}
</SelectItem>
</SelectContent>
</Select>
</template>