Commit 0edd8a6e authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '60387-use-icons-in-user-popovers' into 'master'

Show category icons in user popover

Closes #60387

See merge request gitlab-org/gitlab-ce!27254
parents fed474f5 68afb3ed
<script> <script>
import { GlPopover, GlSkeletonLoading } from '@gitlab/ui'; import { GlPopover, GlSkeletonLoading } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import UserAvatarImage from '../user_avatar/user_avatar_image.vue'; import UserAvatarImage from '../user_avatar/user_avatar_image.vue';
import { glEmojiTag } from '../../../emoji'; import { glEmojiTag } from '../../../emoji';
export default { export default {
name: 'UserPopover', name: 'UserPopover',
components: { components: {
Icon,
GlPopover, GlPopover,
GlSkeletonLoading, GlSkeletonLoading,
UserAvatarImage, UserAvatarImage,
...@@ -68,16 +70,27 @@ export default { ...@@ -68,16 +70,27 @@ export default {
<gl-skeleton-loading v-else :lines="1" class="animation-container-small mb-1" /> <gl-skeleton-loading v-else :lines="1" class="animation-container-small mb-1" />
</div> </div>
<div class="text-secondary"> <div class="text-secondary">
<div v-if="user.bio" class="js-bio">{{ user.bio }}</div> <div v-if="user.bio" class="js-bio d-flex mb-1">
<div v-if="user.organization" class="js-organization">{{ user.organization }}</div> <icon name="profile" css-classes="category-icon" />
<span class="ml-1">{{ user.bio }}</span>
</div>
<div v-if="user.organization" class="js-organization d-flex mb-1">
<icon v-show="!jobInfoIsLoading" name="work" css-classes="category-icon" />
<span class="ml-1">{{ user.organization }}</span>
</div>
<gl-skeleton-loading <gl-skeleton-loading
v-if="jobInfoIsLoading" v-if="jobInfoIsLoading"
:lines="1" :lines="1"
class="animation-container-small mb-1" class="animation-container-small mb-1"
/> />
</div> </div>
<div class="text-secondary"> <div class="js-location text-secondary d-flex">
{{ user.location }} <icon
v-show="!locationIsLoading && user.location"
name="location"
css-classes="category-icon"
/>
<span class="ml-1">{{ user.location }}</span>
<gl-skeleton-loading <gl-skeleton-loading
v-if="locationIsLoading" v-if="locationIsLoading"
:lines="1" :lines="1"
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
padding: $gl-padding-8; padding: $gl-padding-8;
font-size: $gl-font-size-small; font-size: $gl-font-size-small;
line-height: $gl-line-height; line-height: $gl-line-height;
.category-icon {
color: $gray-600;
}
} }
} }
......
---
title: Show category icons in user popover
merge_request:
author:
type: added
...@@ -61,6 +61,12 @@ describe('User Popover Component', () => { ...@@ -61,6 +61,12 @@ describe('User Popover Component', () => {
expect(vm.$el.textContent).toContain(DEFAULT_PROPS.user.username); expect(vm.$el.textContent).toContain(DEFAULT_PROPS.user.username);
expect(vm.$el.textContent).toContain(DEFAULT_PROPS.user.location); expect(vm.$el.textContent).toContain(DEFAULT_PROPS.user.location);
}); });
it('shows icon for location', () => {
const iconEl = vm.$el.querySelector('.js-location svg');
expect(iconEl.querySelector('use').getAttribute('xlink:href')).toContain('location');
});
}); });
describe('job data', () => { describe('job data', () => {
...@@ -117,6 +123,18 @@ describe('User Popover Component', () => { ...@@ -117,6 +123,18 @@ describe('User Popover Component', () => {
'Me & my <funky> Company', 'Me & my <funky> Company',
); );
}); });
it('shows icon for bio', () => {
const iconEl = vm.$el.querySelector('.js-bio svg');
expect(iconEl.querySelector('use').getAttribute('xlink:href')).toContain('profile');
});
it('shows icon for organization', () => {
const iconEl = vm.$el.querySelector('.js-organization svg');
expect(iconEl.querySelector('use').getAttribute('xlink:href')).toContain('work');
});
}); });
describe('status data', () => { describe('status data', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment