Skip to content

Commit

Permalink
Added UserAvatar component.
Browse files Browse the repository at this point in the history
  • Loading branch information
rizen committed Apr 11, 2024
1 parent bf11756 commit 914f4ec
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
15 changes: 15 additions & 0 deletions components/UserAvatar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div v-if="user" class="flex align-items-center">
<Avatar :image="user.meta?.avatarUrl" alt="user avatar" shape="circle" />
<span class="ml-2">
{{ user.meta?.displayName }}
</span>
</div>
<Message v-else severity="error">You may need to <i>includeRelated:['user']</i> to view this.</Message>
</template>

<script setup>
const props = defineProps({
user: Object,
});
</script>
7 changes: 2 additions & 5 deletions components/UserProfileLink.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<template>
<NuxtLink v-if="user" :to="`/user/${user.props.id}/profile`" v-ripple class="flex align-items-center">
<Avatar :image="user.meta?.avatarUrl" alt="user avatar" shape="circle" />
<span class="ml-2">
{{ user.meta?.displayName }}
</span>
<NuxtLink v-if="user" :to="`/user/${user.props.id}/profile`" v-ripple>
<UserAvatar :user="user" />
</NuxtLink>
<Message v-else severity="error">You may need to <i>includeRelated:['user']</i> to view this.</Message>
</template>
Expand Down
1 change: 1 addition & 0 deletions docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ outline: deep
* Implemented: write docs for utils #89
* Fixed: drizzle kit is now interactive #93
* Fixed: cannot dispose useVingRecord on edit page #102
* Added UserAvatar component.

## 2024-04-10
* Implemented: filterQualifier: true should be in the examples for all relation ids #96
Expand Down
10 changes: 9 additions & 1 deletion docs/subsystems/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,16 @@ Place this in your layouts so the user has an indication that there are some bac
</client-only>
```


### UserAvatar
Displays the user's avatar next to their display name.

```html
<UserAvatar :user="user" />
```

### UserProfileLink
Creates a link to a user profile including the user's avatar.
Wraps the `UserAvatar` component in a `NuxtLink` pointing to the user's profile page.

```html
<UserProfileLink :user="user" />
Expand Down

0 comments on commit 914f4ec

Please sign in to comment.