Skip to content

Commit e2a577d

Browse files
authored
feat: add size prop to avatar component and update logo component for size handling (#5684)
1 parent 89d963c commit e2a577d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

packages/@core/ui-kit/shadcn-ui/src/components/avatar/avatar.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ interface Props extends AvatarFallbackProps, AvatarImageProps, AvatarRootProps {
1616
class?: ClassType;
1717
dot?: boolean;
1818
dotClass?: ClassType;
19+
size?: number;
1920
}
2021
2122
defineOptions({
@@ -32,10 +33,23 @@ const props = withDefaults(defineProps<Props>(), {
3233
const text = computed(() => {
3334
return props.alt.slice(-2).toUpperCase();
3435
});
36+
37+
const rootStyle = computed(() => {
38+
return props.size !== undefined && props.size > 0
39+
? {
40+
height: `${props.size}px`,
41+
width: `${props.size}px`,
42+
}
43+
: {};
44+
});
3545
</script>
3646

3747
<template>
38-
<div :class="props.class" class="relative flex flex-shrink-0 items-center">
48+
<div
49+
:class="props.class"
50+
:style="rootStyle"
51+
class="relative flex flex-shrink-0 items-center"
52+
>
3953
<Avatar :class="props.class" class="size-full">
4054
<AvatarImage :alt="alt" :src="src" />
4155
<AvatarFallback>{{ text }}</AvatarFallback>

packages/@core/ui-kit/shadcn-ui/src/components/logo/logo.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ withDefaults(defineProps<Props>(), {
5252
v-if="src"
5353
:alt="text"
5454
:src="src"
55-
class="relative w-8 rounded-none bg-transparent"
55+
:size="logoSize"
56+
class="relative rounded-none bg-transparent"
5657
/>
5758
<span
5859
v-if="!collapsed"

0 commit comments

Comments
 (0)