feat(KAN-18): redesign foundational UI components
This commit is contained in:
@@ -1,18 +1,35 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { AvatarRoot } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
import type { AvatarRootProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { AvatarVariants } from ".";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { AvatarRoot, useForwardProps } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { avatarVariants } from ".";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
AvatarRootProps & {
|
||||
class?: HTMLAttributes["class"];
|
||||
size?: AvatarVariants["size"];
|
||||
shape?: AvatarVariants["shape"];
|
||||
}
|
||||
>(),
|
||||
{ size: "default", shape: "circle" },
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "size", "shape");
|
||||
const forwardedProps = useForwardProps(delegatedProps);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AvatarRoot
|
||||
data-slot="avatar"
|
||||
:class="cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</AvatarRoot>
|
||||
<AvatarRoot
|
||||
data-slot="avatar"
|
||||
:data-size="size"
|
||||
:data-shape="shape"
|
||||
v-bind="forwardedProps"
|
||||
:class="cn(avatarVariants({ size, shape }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</AvatarRoot>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user