48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { h } from "vue";
|
|
import {
|
|
Avatar,
|
|
AvatarRoot,
|
|
AvatarImage,
|
|
AvatarFallback,
|
|
avatarVariants,
|
|
type AvatarProps,
|
|
type AvatarRootProps,
|
|
type AvatarImageProps,
|
|
type AvatarFallbackProps,
|
|
} from "@heroui-vue/components";
|
|
const root: AvatarProps = {
|
|
size: "lg",
|
|
color: "accent",
|
|
variant: "soft",
|
|
as: "div",
|
|
asChild: true,
|
|
};
|
|
const image: AvatarImageProps = {
|
|
asChild: true,
|
|
srcSet: "/a.png 2x",
|
|
sizes: "40px",
|
|
loading: "lazy",
|
|
crossOrigin: "anonymous",
|
|
referrerPolicy: "no-referrer",
|
|
onLoad: (event: Event) => event.type,
|
|
onError: (event: Event) => event.type,
|
|
};
|
|
const fallback: AvatarFallbackProps = {
|
|
delayMs: 0,
|
|
color: "danger",
|
|
asChild: true,
|
|
};
|
|
const rootAlias: AvatarRootProps = root;
|
|
h(AvatarRoot, rootAlias);
|
|
h(AvatarImage, image);
|
|
h(AvatarFallback, fallback);
|
|
// @ts-expect-error baseline size only
|
|
const badRoot: AvatarProps = { size: "xl" };
|
|
// @ts-expect-error baseline color only
|
|
const badFallback: AvatarFallbackProps = { color: "blue" };
|
|
// @ts-expect-error native loading policy
|
|
const badImage: AvatarImageProps = { loading: "immediate" };
|
|
// @ts-expect-error native referrer policy
|
|
const badPolicy: AvatarImageProps = { referrerPolicy: "secret" };
|
|
void [Avatar, avatarVariants, badRoot, badFallback, badImage, badPolicy];
|