chore: determine dimensions of the helix of cat ears based on the size of avatars (#9836)

* chore: determine dimensions of the helix of cat ears based on the size of avatars

* Update MkAvatar.vue

* Update packages/frontend/src/components/global/MkAvatar.vue

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
Acid Chicken (硫酸鶏) 2023-02-10 00:36:05 +09:00 committed by GitHub
parent 83fb629f0b
commit 686a709e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,19 @@
<template> <template>
<span v-if="!link" v-user-preview="preview ? user.id : undefined" :class="[$style.root, { [$style.cat]: user.isCat, [$style.square]: $store.state.squareAvatars }]" class="_noSelect" :style="{ color }" :title="acct(user)" @click="onClick"> <span v-if="!link" v-user-preview="preview ? user.id : undefined" class="_noSelect" :class="[$style.root, { [$style.cat]: user.isCat, [$style.square]: $store.state.squareAvatars }]" :style="{ color }" :title="acct(user)" @click="onClick">
<img :class="$style.inner" :src="url" decoding="async"/> <img :class="$style.inner" :src="url" decoding="async"/>
<MkUserOnlineIndicator v-if="indicator" :class="$style.indicator" :user="user"/> <MkUserOnlineIndicator v-if="indicator" :class="$style.indicator" :user="user"/>
<template v-if="user.isCat">
<div :class="$style.earLeft"/>
<div :class="$style.earRight"/>
</template>
</span> </span>
<MkA v-else v-user-preview="preview ? user.id : undefined" class="_noSelect" :class="[$style.root, { [$style.cat]: user.isCat, [$style.square]: $store.state.squareAvatars }]" :style="{ color }" :to="userPage(user)" :title="acct(user)" :target="target"> <MkA v-else v-user-preview="preview ? user.id : undefined" class="_noSelect" :class="[$style.root, { [$style.cat]: user.isCat, [$style.square]: $store.state.squareAvatars }]" :style="{ color }" :title="acct(user)" :to="userPage(user)" :target="target">
<img :class="$style.inner" :src="url" decoding="async"/> <img :class="$style.inner" :src="url" decoding="async"/>
<MkUserOnlineIndicator v-if="indicator" :class="$style.indicator" :user="user"/> <MkUserOnlineIndicator v-if="indicator" :class="$style.indicator" :user="user"/>
<template v-if="user.isCat">
<div :class="$style.earLeft"/>
<div :class="$style.earRight"/>
</template>
</MkA> </MkA>
</template> </template>
@ -110,32 +118,41 @@ watch(() => props.user.avatarBlurhash, () => {
} }
.cat { .cat {
&:before, &:after { > .earLeft,
background: #df548f; > .earRight {
border: solid 4px currentColor; contain: strict;
box-sizing: border-box;
content: '';
display: inline-block; display: inline-block;
height: 50%; height: 50%;
width: 50%; width: 50%;
background: currentColor;
&::before {
contain: strict;
content: '';
display: block;
width: 60%;
height: 60%;
margin: 20%;
background: #df548f;
}
} }
&:before { > .earLeft {
border-radius: 0 75% 75%; border-radius: 0 75% 75%;
transform: rotate(37.5deg) skew(30deg); transform: rotate(37.5deg) skew(30deg);
} }
&:after { > .earRight {
border-radius: 75% 0 75% 75%; border-radius: 75% 0 75% 75%;
transform: rotate(-37.5deg) skew(-30deg); transform: rotate(-37.5deg) skew(-30deg);
} }
&:hover { &:hover {
&:before { > .earLeft {
animation: earwiggleleft 1s infinite; animation: earwiggleleft 1s infinite;
} }
&:after { > .earRight {
animation: earwiggleright 1s infinite; animation: earwiggleright 1s infinite;
} }
} }