Skip to content

Commit

Permalink
Fix non-user avatar on complex background
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Sep 20, 2022
1 parent 8c19b7c commit 88afaf1
Showing 1 changed file with 39 additions and 11 deletions.
50 changes: 39 additions & 11 deletions src/components/NcAvatar/NcAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ export default {
<NcAvatar display-name="Robbie Hyeon-Jeong" :is-no-user="true" />
```

### Avatar on complex background

```
<template>
<div class="avatar-background">
<NcAvatar class="avatar" :is-no-user="true" display-name="Cecilia Rohese " />
</div>
</template>
<style scoped>
.avatar-background {
width: 80px;
height: 60px;
background: linear-gradient(to bottom, #1b9ee5 0%, #1b9ee5 49.99%, #f4dc00 50%, #f4dc00 100%);
}
.avatar {
margin: 15px 25px;
}
</style>
```

</docs>
<template>
<div ref="main"
Expand Down Expand Up @@ -136,8 +156,10 @@ export default {
:class="'avatardiv__user-status--' + userStatus.status" />

<!-- Show the letter if no avatar nor icon class -->
<div v-if="userDoesNotExist && !(iconClass || $slots.icon)" :style="initialsStyle" class="unknown">
{{ initials }}
<div class="avatardiv__initials-wrapper">
<div v-if="userDoesNotExist && !(iconClass || $slots.icon)" :style="initialsStyle" class="unknown">
{{ initials }}
</div>
</div>
</div>
</template>
Expand Down Expand Up @@ -681,7 +703,6 @@ export default {
&--unknown {
position: relative;
background-color: var(--color-text-maxcontrast);
}
&:not(&--unknown) {
Expand Down Expand Up @@ -716,14 +737,21 @@ export default {
}
}
> .unknown {
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
text-align: center;
font-weight: normal;
.avatardiv__initials-wrapper {
height: var(--size);
width: var(--size);
background-color: var(--color-main-background);
border-radius: 50%;
.unknown {
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
text-align: center;
font-weight: normal;
}
}
img {
Expand Down

0 comments on commit 88afaf1

Please sign in to comment.