Skip to content

Commit

Permalink
feat(avatar): add more size option (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiaking committed Feb 20, 2024
1 parent 74d96b0 commit b118e27
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
34 changes: 27 additions & 7 deletions lib/components/SAvatar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<script setup lang="ts">
import { computed } from 'vue'
export type Size = 'nano' | 'mini' | 'small' | 'medium' | 'large'
export type Size =
| 'nano'
| 'mini'
| 'small'
| 'medium'
| 'large'
| 'jumbo'
| 'mega'
| 'fill'
const props = defineProps<{
size?: Size
Expand Down Expand Up @@ -34,6 +42,14 @@ const initial = computed(() => props.name?.charAt(0).toUpperCase())
overflow: hidden;
}
.img {
object-fit: cover;
}
.initial {
font-weight: 500;
}
.SAvatar.nano {
width: 20px;
height: 20px;
Expand Down Expand Up @@ -64,15 +80,19 @@ const initial = computed(() => props.name?.charAt(0).toUpperCase())
.initial { font-size: 16px; }
}
.SAvatar.no-image {
border: 1px solid var(--c-border-mute-1);
.SAvatar.jumbo {
width: 48px;
height: 48px;
.initial { font-size: 16px; }
}
.img {
object-fit: cover;
.SAvatar.fill {
width: 100%;
aspect-ratio: 1 / 1;
.initial { font-size: 20px; }
}
.initial {
font-weight: 500;
.SAvatar.no-image {
border: 1px solid var(--c-border-mute-1);
}
</style>
3 changes: 2 additions & 1 deletion stories/components/SAvatar.01_Playground.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const variants = [
{ title: 'Mini', size: 'mini' },
{ title: 'Small', size: 'small' },
{ title: 'Medium', size: 'medium' },
{ title: 'Large', size: 'large' }
{ title: 'Large', size: 'large' },
{ title: 'Jumbo', size: 'jumbo' }
] as const
</script>

Expand Down

0 comments on commit b118e27

Please sign in to comment.