fix (client): fix mention icon height (#8615)

This commit is contained in:
tamaina 2022-05-05 20:46:46 +09:00 committed by GitHub
parent 7362c2da76
commit 1168e25721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 19 deletions

View File

@ -1,21 +1,21 @@
<template> <template>
<MkA v-if="url.startsWith('/')" v-user-preview="canonical" class="ldlomzub" :class="{ isMe }" :to="url" :style="{ background: bg }"> <MkA v-if="url.startsWith('/')" v-user-preview="canonical" :class="[$style.root, { isMe }]" :to="url" :style="{ background: bg }">
<img class="icon" :src="`/avatar/@${username}@${host}`" alt=""> <img :class="$style.icon" :src="`/avatar/@${username}@${host}`" alt="">
<span class="main"> <span class="main">
<span class="username">@{{ username }}</span> <span class="username">@{{ username }}</span>
<span v-if="(host != localHost) || $store.state.showFullAcct" class="host">@{{ toUnicode(host) }}</span> <span v-if="(host != localHost) || $store.state.showFullAcct" :class="$style.mainHost">@{{ toUnicode(host) }}</span>
</span> </span>
</MkA> </MkA>
<a v-else class="ldlomzub" :href="url" target="_blank" rel="noopener" :style="{ background: bg }"> <a v-else :class="$style.root" :href="url" target="_blank" rel="noopener" :style="{ background: bg }">
<span class="main"> <span class="main">
<span class="username">@{{ username }}</span> <span class="username">@{{ username }}</span>
<span class="host">@{{ toUnicode(host) }}</span> <span :class="$style.mainHost">@{{ toUnicode(host) }}</span>
</span> </span>
</a> </a>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent, useCssModule } from 'vue';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import { toUnicode } from 'punycode'; import { toUnicode } from 'punycode';
import { host as localHost } from '@/config'; import { host as localHost } from '@/config';
@ -45,6 +45,8 @@ export default defineComponent({
const bg = tinycolor(getComputedStyle(document.documentElement).getPropertyValue(isMe ? '--mentionMe' : '--mention')); const bg = tinycolor(getComputedStyle(document.documentElement).getPropertyValue(isMe ? '--mentionMe' : '--mention'));
bg.setAlpha(0.1); bg.setAlpha(0.1);
useCssModule();
return { return {
localHost, localHost,
isMe, isMe,
@ -57,8 +59,8 @@ export default defineComponent({
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.ldlomzub { .root {
display: inline-block; display: inline-block;
padding: 4px 8px 4px 4px; padding: 4px 8px 4px 4px;
border-radius: 999px; border-radius: 999px;
@ -67,18 +69,18 @@ export default defineComponent({
&.isMe { &.isMe {
color: var(--mentionMe); color: var(--mentionMe);
} }
}
> .icon { .icon {
width: 1.5em; width: 1.5em;
margin: 0 0.2em 0 0; height: 1.5em;
vertical-align: bottom; object-fit: cover;
border-radius: 100%; margin: 0 0.2em 0 0;
} vertical-align: bottom;
border-radius: 100%;
}
> .main { .mainHost {
> .host { opacity: 0.5;
opacity: 0.5;
}
}
} }
</style> </style>