feat: add Separator Kbd and Chip components
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<script setup lang="ts">
|
||||
import { Chip, ChipLabel, Separator } from "@heroui-vue/components";
|
||||
import { IconCircleDashed } from "@tabler/icons-vue";
|
||||
|
||||
const sizes = ["lg", "md", "sm"] as const;
|
||||
|
||||
const SIZE_LABELS: Record<(typeof sizes)[number], string> = {
|
||||
lg: "大",
|
||||
md: "中",
|
||||
sm: "小",
|
||||
};
|
||||
|
||||
const variants = ["primary", "secondary", "tertiary", "soft"] as const;
|
||||
|
||||
const VARIANT_LABELS: Record<(typeof variants)[number], string> = {
|
||||
primary: "主要",
|
||||
secondary: "次要",
|
||||
soft: "柔和",
|
||||
tertiary: "第三",
|
||||
};
|
||||
|
||||
const colors = ["accent", "default", "success", "warning", "danger"] as const;
|
||||
|
||||
const COLOR_LABELS: Record<(typeof colors)[number], string> = {
|
||||
accent: "强调",
|
||||
danger: "危险",
|
||||
default: "默认",
|
||||
success: "成功",
|
||||
warning: "警告",
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col gap-8 overflow-x-auto">
|
||||
<template v-for="(size, index) in sizes" :key="size">
|
||||
<div class="flex flex-col gap-4">
|
||||
<h3 class="text-sm font-semibold text-muted">
|
||||
{{ SIZE_LABELS[size] }}
|
||||
</h3>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-24 shrink-0" />
|
||||
<div
|
||||
v-for="color in colors"
|
||||
:key="color"
|
||||
class="flex shrink-0 items-center justify-center"
|
||||
style="width: 130px"
|
||||
>
|
||||
<span class="text-xs text-muted">{{ COLOR_LABELS[color] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-3">
|
||||
<div
|
||||
v-for="variant in variants"
|
||||
:key="variant"
|
||||
class="flex items-center gap-3"
|
||||
>
|
||||
<div class="w-24 shrink-0 text-sm text-muted">
|
||||
{{ VARIANT_LABELS[variant] }}
|
||||
</div>
|
||||
<div
|
||||
v-for="color in colors"
|
||||
:key="color"
|
||||
class="flex shrink-0 items-center justify-center"
|
||||
style="width: 130px"
|
||||
>
|
||||
<Chip :color="color" :size="size" :variant="variant">
|
||||
<IconCircleDashed aria-hidden="true" />
|
||||
<ChipLabel>标签</ChipLabel>
|
||||
<IconCircleDashed aria-hidden="true" />
|
||||
</Chip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Separator v-if="index < sizes.length - 1" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user