Skip to content

Commit

Permalink
add pixel parameter to IconAvatar
Browse files Browse the repository at this point in the history
  • Loading branch information
soramea committed Dec 18, 2024
1 parent 99974e8 commit 109d5b1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 18 additions & 7 deletions src/shared/lib/components/IconAvatar.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<script setup lang="ts">
import Avatar from 'primevue/avatar';
defineProps<{
import { computed } from 'vue';
const props = defineProps<{
name: string;
pixel: number;
}>();
const size = computed(() => `${props.pixel}px`);
</script>
<template>
<Avatar
:image="`https://q.trap.jp/api/v3/public/icon/${name}`"
class="mr-2"
size="32px"
shape="circle"
<img
:src="`https://q.trap.jp/api/v3/public/icon/` + name"
:width="pixel"
:height="pixel"
/>
</template>

<style lang="scss" scoped>
img {
border-radius: 50%;
width: v-bind(size);
height: v-bind(size);
}
</style>
2 changes: 1 addition & 1 deletion src/shared/lib/components/MainHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div class="right-box">
<ChipCard :label="chipLabel" />
<IconAvatar :name="userName" />
<IconAvatar :name="userName" :pixel="36" />
</div>
</div>
</template>
Expand Down

0 comments on commit 109d5b1

Please sign in to comment.