feat: add CloseButton Avatar and Skeleton components
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="约翰·多伊"
|
||||
src="https://img.heroui.chat/image/avatar?w=400&h=400&u=3"
|
||||
/>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="蓝色头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>B</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>JR</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<Avatar color="default">
|
||||
<AvatarFallback>DF</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="accent">
|
||||
<AvatarFallback>AC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="success">
|
||||
<AvatarFallback>SC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="warning">
|
||||
<AvatarFallback>WR</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="danger">
|
||||
<AvatarFallback>DG</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
import { defineComponent, h } from "vue";
|
||||
|
||||
const SRC =
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg";
|
||||
|
||||
/** Stand-in for a framework image component (e.g. Next.js Image). */
|
||||
const FrameworkImage = defineComponent({
|
||||
name: "FrameworkImage",
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
src: { type: String, required: true },
|
||||
alt: { type: String, default: "" },
|
||||
width: { type: [Number, String], default: 40 },
|
||||
height: { type: [Number, String], default: 40 },
|
||||
},
|
||||
setup(props, { attrs }) {
|
||||
return () =>
|
||||
h("img", {
|
||||
...attrs,
|
||||
src: props.src,
|
||||
alt: props.alt,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
});
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Avatar>
|
||||
<AvatarImage :src="SRC" as-child>
|
||||
<FrameworkImage :src="SRC" alt="约翰·多伊" :width="40" :height="40" />
|
||||
</AvatarImage>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Avatar class="rounded-lg">
|
||||
<AvatarImage
|
||||
alt="张三"
|
||||
src="https://img.heroui.chat/image/avatar?w=400&h=400&u=3"
|
||||
/>
|
||||
<AvatarFallback class="rounded-lg">张三</AvatarFallback>
|
||||
</Avatar>
|
||||
</template>
|
||||
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
import { IconUser } from "@tabler/icons-vue";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<!-- 文字回退 -->
|
||||
<Avatar>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<!-- 图标回退 -->
|
||||
<Avatar>
|
||||
<AvatarFallback>
|
||||
<IconUser aria-hidden="true" class="size-4 shrink-0" />
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<!-- 延迟显示回退 -->
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="延迟加载头像"
|
||||
src="https://invalid-url-to-show-fallback.com/image.jpg"
|
||||
/>
|
||||
<AvatarFallback :delay-ms="600">NA</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<!-- 自定义样式回退 -->
|
||||
<Avatar>
|
||||
<AvatarFallback
|
||||
class="border-none bg-gradient-to-br from-pink-500 to-purple-500 text-white"
|
||||
>
|
||||
GB
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup>
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarGroupCount,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
|
||||
const total = 12;
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup size="sm">
|
||||
<Avatar v-for="user in users.slice(0, 3)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+{{ total - 3 }}</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,56 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarGroupCount,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconUser } from "@tabler/icons-vue";
|
||||
|
||||
const assignees = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
] as const;
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="inline-flex items-center gap-2.5 rounded-full border border-border/70 bg-surface/95 py-1 pr-3 pl-1 shadow-sm ring-1 ring-black/[0.04] dark:border-border/80 dark:bg-surface/90 dark:ring-white/10"
|
||||
>
|
||||
<AvatarGroup
|
||||
aria-label="指派人"
|
||||
class="[--avatar-group-overlap:0.7rem] [--avatar-group-seam:2px]"
|
||||
overlap="clip"
|
||||
role="group"
|
||||
size="sm"
|
||||
>
|
||||
<Avatar v-for="user in assignees" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ user.name.slice(0, 1) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>
|
||||
<IconUser aria-hidden="true" class="size-4 shrink-0" />
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+3</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
<span class="text-sm font-medium text-foreground">指派人</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup is-grid :max="5">
|
||||
<Avatar v-for="user in users" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup :max="3">
|
||||
<Avatar v-for="user in users" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,104 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarGroupCount,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@keyframes ag-stripes {
|
||||
to {
|
||||
background-position: 24px 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.ag-stripes {
|
||||
background-color: color-mix(in oklab, var(--danger) 6%, var(--surface));
|
||||
background-image: repeating-linear-gradient(
|
||||
-45deg,
|
||||
transparent 0 10px,
|
||||
color-mix(in oklab, var(--danger) 12%, transparent) 10px 11px,
|
||||
transparent 11px 21px,
|
||||
color-mix(in oklab, var(--danger) 28%, transparent) 21px 22px
|
||||
);
|
||||
background-size: 24px 24px;
|
||||
animation: ag-stripes 2.8s linear infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col items-start gap-6">
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm text-muted">clip</p>
|
||||
<div class="relative inline-flex rounded-xl p-6">
|
||||
<div
|
||||
aria-hidden
|
||||
class="ag-stripes pointer-events-none absolute inset-0 rounded-xl"
|
||||
/>
|
||||
<div class="relative z-10">
|
||||
<AvatarGroup overlap="clip" size="lg">
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="John"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>AB</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="Emily"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg"
|
||||
/>
|
||||
<AvatarFallback>EC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>SM</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+2</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm text-muted">ring</p>
|
||||
<div class="relative inline-flex rounded-xl p-6">
|
||||
<div
|
||||
aria-hidden
|
||||
class="ag-stripes pointer-events-none absolute inset-0 rounded-xl"
|
||||
/>
|
||||
<div class="relative z-10">
|
||||
<AvatarGroup overlap="ring" size="lg">
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="John"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>AB</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="Emily"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg"
|
||||
/>
|
||||
<AvatarFallback>EC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>SM</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+2</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,82 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col items-center gap-6">
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<p class="text-sm text-muted">小号</p>
|
||||
<AvatarGroup size="sm">
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<p class="text-sm text-muted">中号(默认)</p>
|
||||
<AvatarGroup size="md">
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<p class="text-sm text-muted">大号</p>
|
||||
<AvatarGroup size="lg">
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<Avatar size="sm">
|
||||
<AvatarImage
|
||||
alt="小尺寸头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>SM</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar size="md">
|
||||
<AvatarImage
|
||||
alt="中尺寸头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg"
|
||||
/>
|
||||
<AvatarFallback>MD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar size="lg">
|
||||
<AvatarImage
|
||||
alt="大尺寸头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg"
|
||||
/>
|
||||
<AvatarFallback>LG</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,84 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
import { IconUser } from "@tabler/icons-vue";
|
||||
|
||||
const colors = ["accent", "default", "success", "warning", "danger"] as const;
|
||||
|
||||
const COLOR_LABELS: Record<(typeof colors)[number], string> = {
|
||||
accent: "强调",
|
||||
danger: "危险",
|
||||
default: "默认",
|
||||
success: "成功",
|
||||
warning: "警告",
|
||||
};
|
||||
|
||||
const variants = [
|
||||
{ content: "AG", label: "字母", type: "letter" },
|
||||
{ content: "AG", label: "柔和字母", type: "letter-soft" },
|
||||
{ content: "icon", label: "图标", type: "icon" },
|
||||
{ content: "icon", label: "柔和图标", type: "icon-soft" },
|
||||
{
|
||||
content: [
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=3",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=4",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=5",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=8",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=16",
|
||||
],
|
||||
label: "图片",
|
||||
type: "img",
|
||||
},
|
||||
] as const;
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<!-- 颜色列标题 -->
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-24 shrink-0" />
|
||||
<div
|
||||
v-for="color in colors"
|
||||
:key="color"
|
||||
class="flex w-20 shrink-0 items-center justify-center"
|
||||
>
|
||||
<span class="text-xs text-muted">{{ COLOR_LABELS[color] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="h-px w-full bg-separator" />
|
||||
|
||||
<!-- 变体行 -->
|
||||
<div
|
||||
v-for="variant in variants"
|
||||
:key="variant.label"
|
||||
class="flex items-center gap-3"
|
||||
>
|
||||
<div class="w-24 shrink-0 text-sm text-muted">{{ variant.label }}</div>
|
||||
<div
|
||||
v-for="(color, colorIndex) in colors"
|
||||
:key="color"
|
||||
class="flex w-20 shrink-0 items-center justify-center"
|
||||
>
|
||||
<Avatar
|
||||
:color="color"
|
||||
:variant="variant.type.includes('soft') ? 'soft' : undefined"
|
||||
>
|
||||
<template v-if="variant.type === 'img'">
|
||||
<AvatarImage
|
||||
:alt="`${COLOR_LABELS[color]} 头像`"
|
||||
:src="
|
||||
Array.isArray(variant.content)
|
||||
? variant.content[colorIndex]
|
||||
: ''
|
||||
"
|
||||
/>
|
||||
<AvatarFallback>{{ COLOR_LABELS[color].charAt(0) }}</AvatarFallback>
|
||||
</template>
|
||||
<AvatarFallback v-else-if="variant.content === 'icon'">
|
||||
<IconUser aria-hidden="true" class="size-4 shrink-0" />
|
||||
</AvatarFallback>
|
||||
<AvatarFallback v-else>{{ variant.content }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,6 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { closeButtonVariants } from "@heroui-vue/styles";
|
||||
import { IconX } from "@tabler/icons-vue";
|
||||
import {
|
||||
Card,
|
||||
CardHeader,
|
||||
@@ -8,6 +6,7 @@ import {
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
Button,
|
||||
CloseButton,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
@@ -28,14 +27,7 @@ import {
|
||||
<CardDescription>
|
||||
这是一段占位说明文字,用于展示横向卡片布局、配图与右上角关闭按钮的排版效果。
|
||||
</CardDescription>
|
||||
<button
|
||||
type="button"
|
||||
:class="closeButtonVariants()"
|
||||
aria-label="关闭横幅"
|
||||
class="absolute end-3 top-3"
|
||||
>
|
||||
<IconX aria-hidden="true" />
|
||||
</button>
|
||||
<CloseButton aria-label="关闭横幅" class="absolute end-3 top-3" />
|
||||
</CardHeader>
|
||||
<CardFooter
|
||||
class="mt-auto flex w-full flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between"
|
||||
|
||||
@@ -5,8 +5,10 @@ import {
|
||||
CardTitle,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
Avatar,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
@@ -22,7 +24,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<CardDescription>148 位成员</CardDescription>
|
||||
</CardHeader>
|
||||
<CardFooter class="flex gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
aria-label="玛莎的头像"
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-5"
|
||||
>
|
||||
@@ -36,7 +38,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
IH
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<span class="text-xs">创建者:玛莎</span>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
@@ -53,7 +55,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<CardDescription>362 位成员</CardDescription>
|
||||
</CardHeader>
|
||||
<CardFooter class="flex gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
aria-label="约翰的头像"
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-5"
|
||||
>
|
||||
@@ -67,7 +69,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
B
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<span class="text-xs">创建者:约翰</span>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { closeButtonVariants } from "@heroui-vue/styles";
|
||||
import { IconX } from "@tabler/icons-vue";
|
||||
import { IconCoin } from "@tabler/icons-vue";
|
||||
import {
|
||||
Card,
|
||||
@@ -10,10 +8,13 @@ import {
|
||||
CardContent,
|
||||
CardFooter,
|
||||
Button,
|
||||
CloseButton,
|
||||
Avatar,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
Link,
|
||||
LinkIcon,
|
||||
} from "@heroui-vue/components";
|
||||
import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex w-full items-center justify-center">
|
||||
@@ -35,14 +36,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<CardDescription>
|
||||
这是一段占位说明文字,用于展示横向卡片布局、配图与右上角关闭按钮的排版效果。
|
||||
</CardDescription>
|
||||
<button
|
||||
type="button"
|
||||
:class="closeButtonVariants()"
|
||||
aria-label="关闭横幅"
|
||||
class="absolute end-3 top-3"
|
||||
>
|
||||
<IconX aria-hidden="true" />
|
||||
</button>
|
||||
<CloseButton aria-label="关闭横幅" class="absolute end-3 top-3" />
|
||||
</CardHeader>
|
||||
<CardFooter
|
||||
class="mt-auto flex w-full flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between"
|
||||
@@ -62,13 +56,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<div class="col-span-12 grid grid-cols-12 gap-4 lg:col-span-6">
|
||||
<Card class="col-span-12">
|
||||
<div class="absolute end-3 top-3 z-10">
|
||||
<button
|
||||
type="button"
|
||||
:class="closeButtonVariants()"
|
||||
aria-label="关闭通知"
|
||||
>
|
||||
<IconX aria-hidden="true" />
|
||||
</button>
|
||||
<CloseButton aria-label="关闭通知" />
|
||||
</div>
|
||||
<CardHeader class="gap-3">
|
||||
<IconCoin
|
||||
@@ -99,7 +87,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<div class="col-span-12 grid grid-cols-12 gap-4">
|
||||
<Card class="col-span-12 gap-2 sm:col-span-6">
|
||||
<CardHeader>
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-[56px] rounded-xl"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -112,14 +100,14 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
JK
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
</CardHeader>
|
||||
<CardContent class="mt-1">
|
||||
<p class="text-sm leading-4 font-medium">Indie Hackers</p>
|
||||
<p class="text-xs text-muted">148 位成员</p>
|
||||
</CardContent>
|
||||
<CardFooter class="flex items-center gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-4"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -132,14 +120,14 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
JK
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<p class="text-xs text-muted">创建者:约翰</p>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
|
||||
<Card class="col-span-12 gap-2 sm:col-span-6">
|
||||
<CardHeader>
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-[56px] rounded-xl"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -152,14 +140,14 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
AB
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
</CardHeader>
|
||||
<CardContent class="mt-1">
|
||||
<p class="text-sm leading-4 font-medium">AI Builders</p>
|
||||
<p class="text-xs text-muted">362 位成员</p>
|
||||
</CardContent>
|
||||
<CardFooter class="flex items-center gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-4"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -172,7 +160,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
M
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<p class="text-xs text-muted">创建者:玛莎</p>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<CloseButton
|
||||
aria-label="关闭"
|
||||
class="size-8 rounded-full bg-default text-muted hover:bg-default-hover hover:text-foreground active:scale-95"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<CloseButton />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
|
||||
const count = ref(0);
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col items-center justify-center gap-4">
|
||||
<CloseButton :aria-label="`关闭(已点击 ${count} 次)`" @click="count++" />
|
||||
<span class="text-sm text-muted">已点击:{{ count }} 次</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
import { IconCircleX, IconX } from "@tabler/icons-vue";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<CloseButton>
|
||||
<IconCircleX aria-hidden="true" />
|
||||
</CloseButton>
|
||||
<span class="text-xs text-muted">自定义图标</span>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<CloseButton>
|
||||
<IconX aria-hidden="true" />
|
||||
</CloseButton>
|
||||
<span class="text-xs text-muted">备选图标</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,35 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="grid w-full max-w-xl grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3"
|
||||
>
|
||||
<div class="space-y-2">
|
||||
<p class="truncate text-xs text-muted">微光</p>
|
||||
<div class="shadow-panel space-y-3 rounded-lg bg-transparent p-4">
|
||||
<Skeleton animation-type="shimmer" class="h-20 rounded-lg" />
|
||||
<Skeleton animation-type="shimmer" class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton animation-type="shimmer" class="h-3 w-4/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<p class="truncate text-xs text-muted">脉冲</p>
|
||||
<div class="shadow-panel space-y-3 rounded-lg bg-transparent p-4">
|
||||
<Skeleton animation-type="pulse" class="h-20 rounded-lg" />
|
||||
<Skeleton animation-type="pulse" class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton animation-type="pulse" class="h-3 w-4/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<p class="truncate text-xs text-muted">无</p>
|
||||
<div class="shadow-panel space-y-3 rounded-lg bg-transparent p-4">
|
||||
<Skeleton animation-type="none" class="h-20 rounded-lg" />
|
||||
<Skeleton animation-type="none" class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton animation-type="none" class="h-3 w-4/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="shadow-panel w-[250px] space-y-5 rounded-lg bg-transparent p-4">
|
||||
<Skeleton class="h-32 rounded-lg" />
|
||||
<div class="space-y-3">
|
||||
<Skeleton class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton class="h-3 w-4/5 rounded-lg" />
|
||||
<Skeleton class="h-3 w-2/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
|
||||
const bone =
|
||||
"animate-shine rounded-lg bg-neutral-200/90 dark:bg-neutral-800/90";
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="w-[250px] space-y-5 rounded-xl border border-border/80 bg-surface p-4 shadow-sm ring-1 ring-black/5 dark:ring-white/10"
|
||||
>
|
||||
<Skeleton :class="`h-32 ${bone}`" />
|
||||
<div class="space-y-3">
|
||||
<Skeleton :class="`h-3 w-3/5 ${bone}`" />
|
||||
<Skeleton :class="`h-3 w-4/5 ${bone}`" />
|
||||
<Skeleton :class="`h-3 w-2/5 ${bone}`" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="grid w-full max-w-xl grid-cols-3 gap-4">
|
||||
<Skeleton class="h-24 rounded-xl" />
|
||||
<Skeleton class="h-24 rounded-xl" />
|
||||
<Skeleton class="h-24 rounded-xl" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="w-full max-w-sm space-y-4">
|
||||
<div v-for="index in 3" :key="index" class="flex items-center gap-3">
|
||||
<Skeleton class="h-10 w-10 shrink-0 rounded-lg" />
|
||||
<div class="flex-1 space-y-2">
|
||||
<Skeleton class="h-3 w-full rounded" />
|
||||
<Skeleton class="h-3 w-4/5 rounded" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="hv-skeleton--shimmer relative grid w-full max-w-xl grid-cols-3 gap-4 overflow-hidden rounded-xl"
|
||||
>
|
||||
<Skeleton animation-type="none" class="h-24 rounded-xl" />
|
||||
<Skeleton animation-type="none" class="h-24 rounded-xl" />
|
||||
<Skeleton animation-type="none" class="h-24 rounded-xl" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="w-full max-w-md space-y-3">
|
||||
<Skeleton class="h-4 w-full rounded" />
|
||||
<Skeleton class="h-4 w-5/6 rounded" />
|
||||
<Skeleton class="h-4 w-4/6 rounded" />
|
||||
<Skeleton class="h-4 w-full rounded" />
|
||||
<Skeleton class="h-4 w-3/6 rounded" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-3">
|
||||
<Skeleton class="h-10 w-10 shrink-0 rounded-full" />
|
||||
<div class="flex-1 space-y-2">
|
||||
<Skeleton class="h-3 w-36 rounded-lg" />
|
||||
<Skeleton class="h-3 w-24 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user