1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-27 13:08:23 +09:00
misskey/src/client/app/common/views/components/mention.vue

71 lines
1.5 KiB
Vue
Raw Normal View History

2018-12-12 13:06:05 +09:00
<template>
<router-link class="ldlomzub" :to="`/${ canonical }`" v-user-preview="canonical">
2018-12-12 13:06:05 +09:00
<span class="me" v-if="isMe">{{ $t('@.you') }}</span>
<span class="main">
<span class="username">@{{ username }}</span>
<span class="host" :class="{ fade: $store.state.settings.contrastedAcct }" v-if="(host != localHost) || $store.state.settings.showFullAcct">@{{ toUnicode(host) }}</span>
</span>
</router-link>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import { toUnicode } from 'punycode';
import { host as localHost } from '../../../config';
export default Vue.extend({
i18n: i18n(),
props: {
username: {
type: String,
required: true
},
host: {
type: String,
required: true
}
},
data() {
return {
localHost
};
},
computed: {
canonical(): string {
return `@${this.username}@${toUnicode(this.host)}`;
},
isMe(): boolean {
return this.$store.getters.isSignedIn && this.canonical.toLowerCase() === `@${this.$store.state.i.username}@${toUnicode(localHost)}`.toLowerCase();
}
},
methods: {
toUnicode
}
});
</script>
<style lang="stylus" scoped>
.ldlomzub
color var(--mfmMention)
> .me
pointer-events none
user-select none
padding 0 4px
2018-12-30 13:19:06 +09:00
background var(--mfmMention)
2018-12-30 14:00:57 +09:00
border solid var(--lineWidth) var(--mfmMention)
2018-12-12 13:06:05 +09:00
border-radius 4px 0 0 4px
2018-12-30 13:19:06 +09:00
color var(--mfmMentionForeground)
2018-12-12 13:06:05 +09:00
& + .main
padding 0 4px
2018-12-30 14:00:57 +09:00
border solid var(--lineWidth) var(--mfmMention)
2018-12-12 13:06:05 +09:00
border-radius 0 4px 4px 0
> .main
> .host.fade
opacity 0.5
</style>