Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(avatar): decrease avatar size from 44px to 36px #12956

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/AvatarWrapper/AvatarWrapper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'

import AvatarWrapper from './AvatarWrapper.vue'

import { AVATAR } from '../../constants.js'
import storeConfig from '../../store/storeConfig.js'

describe('AvatarWrapper.vue', () => {
Expand Down Expand Up @@ -39,7 +40,7 @@ describe('AvatarWrapper.vue', () => {

const avatar = wrapper.findComponent(NcAvatar)
expect(avatar.exists()).toBeTruthy()
expect(avatar.props('size')).toBe(44)
expect(avatar.props('size')).toBe(AVATAR.SIZE.DEFAULT)
})

test('component does not render NcAvatar for non-users', () => {
Expand Down Expand Up @@ -89,7 +90,7 @@ describe('AvatarWrapper.vue', () => {
expect(avatar.props('showUserStatus')).toBe(true)
expect(avatar.props('showUserStatusCompact')).toBe(false)
expect(avatar.props('preloadedUserStatus')).toBe(PRELOADED_USER_STATUS)
expect(avatar.props('size')).toBe(44)
expect(avatar.props('size')).toBe(AVATAR.SIZE.DEFAULT)
})
})

Expand Down
15 changes: 9 additions & 6 deletions src/components/ConversationIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
role="img"
aria-hidden="false"
:aria-label="conversationType.label">
<component :is="conversationType.icon" :size="14" />
<component :is="conversationType.icon" :size="12" />
</span>
</template>
<!-- NcAvatar doesn't fully support props update and works only for 1 user -->
Expand Down Expand Up @@ -265,11 +265,14 @@ export default {

&__type {
position: absolute;
right: -4px;
bottom: -4px;
height: 18px;
width: 18px;
border: 2px solid var(--color-main-background);
right: -2px;
bottom: -2px;
display: flex;
align-content: center;
justify-content: center;
height: clamp(14px, 40%, 18px);
width: clamp(14px, 40%, 18px);
border: 1px solid var(--color-main-background);
background-color: var(--color-main-background);
color: var(--color-main-text);
border-radius: 50%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import LoadingPlaceholder from '../../UIShared/LoadingPlaceholder.vue'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'

/* Consider:
* 45 = 2lh - 2 lines of text
* 36 = 2 * 1.2 * var(--default-font-size) - two lines of text
* 8 = 2 * var(--default-grid-baseline) - item padding
* 4 = var(--default-grid-baseline) - item outline (collapsed)
*/
const CONVERSATION_ITEM_SIZE = 61
const CONVERSATION_ITEM_SIZE = 48

export default {
name: 'ConversationsListVirtual',
Expand Down
3 changes: 3 additions & 0 deletions src/components/LeftSidebar/InvitationHandler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,14 @@ export default {
padding-left: 4px;

&__name {
line-height: 1.2;
font-weight: bold;
color: var(--color-main-text);
}

&__subname {
// Overwrite NcRichText styles
line-height: 1.2 !important;
color: var(--color-text-maxcontrast);
}
}
Expand Down
17 changes: 15 additions & 2 deletions src/components/LeftSidebar/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
data-nav-id="conversation_create_new"
@click="createConversation(searchText)">
<template #icon>
<ChatPlus :size="44" />
<ChatPlus :size="AVATAR.SIZE.DEFAULT" />
</template>
<template #subname>
{{ t('spreed', 'New group conversation') }}
Expand Down Expand Up @@ -336,7 +336,7 @@ import SearchBox from '../UIShared/SearchBox.vue'
import TransitionWrapper from '../UIShared/TransitionWrapper.vue'

import { useArrowNavigation } from '../../composables/useArrowNavigation.js'
import { ATTENDEE, CONVERSATION } from '../../constants.js'
import { ATTENDEE, AVATAR, CONVERSATION } from '../../constants.js'
import BrowserStorage from '../../services/BrowserStorage.js'
import { getTalkConfig, hasTalkFeature } from '../../services/CapabilitiesManager.ts'
import {
Expand Down Expand Up @@ -410,6 +410,7 @@ export default {
const isMobile = useIsMobile()

return {
AVATAR,
initializeNavigation,
resetNavigation,
leftSidebar,
Expand Down Expand Up @@ -1088,8 +1089,20 @@ export default {
padding: 0 !important;
}

// Overwrite NcListItem styles
:deep(.list-item) {
line-height: 1.2;
overflow: hidden;
outline-offset: -2px;

// FIXME clean up after nextcloud/vue release
.avatardiv .avatardiv__user-status {
right: -2px !important;
bottom: -2px !important;
min-height: 14px !important;
min-width: 14px !important;
line-height: 1 !important;
font-size: clamp(var(--font-size-small), 85%, var(--default-font-size)) !important;
}
}
</style>
11 changes: 11 additions & 0 deletions src/components/RightSidebar/Participants/Participant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,7 @@ export default {
.participant {
// Overwrite NcListItem styles
:deep(.list-item) {
line-height: 1.2;
overflow: hidden;
outline-offset: -2px;
cursor: default;
Expand All @@ -1146,6 +1147,16 @@ export default {
button, button * {
cursor: pointer;
}

// FIXME clean up after nextcloud/vue release
.avatardiv .avatardiv__user-status {
right: -2px !important;
bottom: -2px !important;
min-height: 14px !important;
min-width: 14px !important;
line-height: 1 !important;
font-size: clamp(var(--font-size-small), 85%, var(--default-font-size)) !important;
}
}

&--offline &__user-name {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ import LoadingPlaceholder from '../../UIShared/LoadingPlaceholder.vue'

import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'

const PARTICIPANT_ITEM_SIZE = 64
/* Consider:
* 36 = 2 * 1.2 * var(--default-font-size) - two lines of text
* 8 = 2 * var(--default-grid-baseline) - item padding
* 4 = var(--default-grid-baseline) - item outline (collapsed)
*/
const PARTICIPANT_ITEM_SIZE = 48

export default {
name: 'ParticipantsListVirtual',
Expand Down
9 changes: 4 additions & 5 deletions src/components/TopBar/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class="conversation-icon"
:offline="isPeerInactive"
:item="conversation"
:size="iconSize"
:size="AVATAR.SIZE.DEFAULT"
:disable-menu="false"
show-user-online-status
:hide-favorite="false"
Expand Down Expand Up @@ -129,7 +129,7 @@ import BreakoutRoomsEditor from '../BreakoutRoomsEditor/BreakoutRoomsEditor.vue'
import ConversationIcon from '../ConversationIcon.vue'

import { useGetParticipants } from '../../composables/useGetParticipants.js'
import { CONVERSATION } from '../../constants.js'
import { AVATAR, CONVERSATION } from '../../constants.js'
import BrowserStorage from '../../services/BrowserStorage.js'
import { getTalkConfig } from '../../services/CapabilitiesManager.ts'
import { useChatExtrasStore } from '../../stores/chatExtras.js'
Expand Down Expand Up @@ -177,12 +177,11 @@ export default {

setup() {
useGetParticipants()
const iconSize = parseFloat(getComputedStyle(document.documentElement)
.getPropertyValue('--default-clickable-area'))

return {
AVATAR,
localCallParticipantModel,
localMediaModel,
iconSize,
chatExtrasStore: useChatExtrasStore(),
isMobile: useIsMobile(),
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/UIShared/LoadingPlaceholder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export default {
&__avatar {
flex-shrink: 0;
&-circle {
height: 44px; // AVATAR.SIZE.DEFAULT
width: 44px;
border-radius: 44px;
height: 36px; // AVATAR.SIZE.DEFAULT
width: 36px;
border-radius: 36px;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export const AVATAR = {
SIZE: {
EXTRA_SMALL: 22,
SMALL: 32,
DEFAULT: 44,
DEFAULT: 36,
MEDIUM: 64,
LARGE: 128,
EXTRA_LARGE: 180,
Expand Down
Loading