Skip to content

Commit b118e27

Browse files
authored
feat(avatar): add more size option (#475)
1 parent 74d96b0 commit b118e27

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

lib/components/SAvatar.vue

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<script setup lang="ts">
22
import { computed } from 'vue'
33
4-
export type Size = 'nano' | 'mini' | 'small' | 'medium' | 'large'
4+
export type Size =
5+
| 'nano'
6+
| 'mini'
7+
| 'small'
8+
| 'medium'
9+
| 'large'
10+
| 'jumbo'
11+
| 'mega'
12+
| 'fill'
513
614
const props = defineProps<{
715
size?: Size
@@ -34,6 +42,14 @@ const initial = computed(() => props.name?.charAt(0).toUpperCase())
3442
overflow: hidden;
3543
}
3644
45+
.img {
46+
object-fit: cover;
47+
}
48+
49+
.initial {
50+
font-weight: 500;
51+
}
52+
3753
.SAvatar.nano {
3854
width: 20px;
3955
height: 20px;
@@ -64,15 +80,19 @@ const initial = computed(() => props.name?.charAt(0).toUpperCase())
6480
.initial { font-size: 16px; }
6581
}
6682
67-
.SAvatar.no-image {
68-
border: 1px solid var(--c-border-mute-1);
83+
.SAvatar.jumbo {
84+
width: 48px;
85+
height: 48px;
86+
.initial { font-size: 16px; }
6987
}
7088
71-
.img {
72-
object-fit: cover;
89+
.SAvatar.fill {
90+
width: 100%;
91+
aspect-ratio: 1 / 1;
92+
.initial { font-size: 20px; }
7393
}
7494
75-
.initial {
76-
font-weight: 500;
95+
.SAvatar.no-image {
96+
border: 1px solid var(--c-border-mute-1);
7797
}
7898
</style>

stories/components/SAvatar.01_Playground.story.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const variants = [
99
{ title: 'Mini', size: 'mini' },
1010
{ title: 'Small', size: 'small' },
1111
{ title: 'Medium', size: 'medium' },
12-
{ title: 'Large', size: 'large' }
12+
{ title: 'Large', size: 'large' },
13+
{ title: 'Jumbo', size: 'jumbo' }
1314
] as const
1415
</script>
1516

0 commit comments

Comments
 (0)