Skip to content

Commit

Permalink
fix: avatar glitches in some OS/browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 28, 2022
1 parent 8a338ed commit ab4ceae
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
16 changes: 16 additions & 0 deletions components/account/AccountBigAvatar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup lang="ts">
import type { Account } from 'masto'
// Avatar with a background base achieving a 3px border to be used in status cards
// The border is used for Avatar on Avatar for reblogs and connecting replies
defineProps<{
account: Account
}>()
</script>

<template>
<div :key="account.avatar" v-bind="$attrs" rounded-full bg-base w-54px h-54px flex items-center justify-center>
<AccountAvatar :account="account" w-48px h-48px />
</div>
</template>
2 changes: 1 addition & 1 deletion components/account/AccountInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defineOptions({
<template>
<component :is="as" flex gap-3 v-bind="$attrs">
<AccountHoverWrapper :disabled="!hoverCard" :account="account" shrink-0>
<AccountAvatar :account="account" account-avatar-normal />
<AccountBigAvatar :account="account" />
</AccountHoverWrapper>
<div flex="~ col" shrink overflow-hidden justify-center leading-none>
<div flex="~" gap-2>
Expand Down
2 changes: 1 addition & 1 deletion components/publish/PublishWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ defineExpose({

<div flex gap-3 flex-1>
<NuxtLink :to="getAccountRoute(currentUser.account)">
<AccountAvatar :account="currentUser.account" account-avatar-normal />
<AccountBigAvatar :account="currentUser.account" />
</NuxtLink>
<!-- This `w-0` style is used to avoid overflow problems in flex layouts,so don't remove it unless you know what you're doing -->
<div
Expand Down
2 changes: 1 addition & 1 deletion components/status/StatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const isSelf = $computed(() => status.account.id === currentUser.value?.account.
</template>
<AccountHoverWrapper :account="status.account">
<NuxtLink :to="getAccountRoute(status.account)" rounded-full>
<AccountAvatar :account="status.account" account-avatar-normal :class="showRebloggedByAvatarOnAvatar ? 'mt-11px ' : 'mt-3px'" />
<AccountBigAvatar :account="status.account" :class="showRebloggedByAvatarOnAvatar ? 'mt-11px ' : 'mt-3px'" />
</NuxtLink>
</AccountHoverWrapper>
<div v-if="connectReply" w-full h-full flex justify-center>
Expand Down
3 changes: 0 additions & 3 deletions unocss.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ export default defineConfig({
'flex-v-center': 'items-center',
'flex-h-center': 'justify-center',
'bg-hover-overflow': 'relative z-0 transition-colors duration-250 after-content-empty after:(absolute inset--2px bg-transparent rounded-lg z--1 transition-colors duration-250) hover:after:(bg-active)',

// account
'account-avatar-normal': 'w-54px h-54px border-3 border-bg-base',
},
],
presets: [
Expand Down

0 comments on commit ab4ceae

Please sign in to comment.