sepia-search-motore-di-rice.../client/src/components/ActorMiniature.vue

95 lines
1.9 KiB
Vue
Raw Normal View History

2020-08-27 14:44:21 +02:00
<template>
2020-09-24 10:12:33 +02:00
<a v-bind:href="actor.url" rel="nofollow noreferrer noopener" target="_blank" class="actor" v-bind:title="linkTitle">
2021-07-01 10:28:08 +02:00
<img v-if="actor.avatar && !avatarError" v-bind:src="actor.avatar.url" alt="" :class="{ account: isAccount }" @error="setAvatarError()">
2020-08-27 14:44:21 +02:00
<strong>{{ actor.displayName }}</strong>
<span class="actor-handle">
{{ actor.name }}@{{actor.host}}
</span>
</a>
</template>
<style lang="scss">
@import '../scss/_variables';
.actor {
font-size: inherit;
color: #000;
text-decoration: none;
2021-11-24 13:51:35 +01:00
display: flex;
flex-wrap: wrap;
2020-08-27 14:44:21 +02:00
&:hover {
text-decoration: underline;
}
img {
object-fit: cover;
width: 20px;
height: 20px;
min-width: 20px;
min-height: 20px;
margin-right: 5px;
2021-07-01 09:24:54 +02:00
&.account {
border-radius: 50%;
}
2020-08-27 14:44:21 +02:00
}
.actor-handle {
color: $grey;
margin: 0 5px;
}
strong,
.actor-handle {
vertical-align: super;
}
@media screen and (max-width: $small-view) {
.actor-handle {
display: block;
margin: 0 0 10px 0;
}
}
}
</style>
<script lang="ts">
2021-06-25 11:44:32 +02:00
import { defineComponent, PropType } from 'vue'
2020-08-27 14:44:21 +02:00
import { AccountSummary, VideoChannelSummary } from '../../../PeerTube/shared/models'
2021-06-25 11:44:32 +02:00
export default defineComponent({
2020-08-27 14:44:21 +02:00
props: {
actor: Object as PropType<AccountSummary | VideoChannelSummary>,
type: String
},
2021-07-01 10:28:08 +02:00
data () {
return {
avatarError: false
}
},
methods: {
setAvatarError () {
this.avatarError = true
}
},
2020-08-27 14:44:21 +02:00
computed: {
2021-06-25 11:44:32 +02:00
linkTitle (): string {
2020-09-01 11:50:55 +02:00
if (this.type === 'channel') return this.$gettext('Go on this channel page')
2020-08-27 14:44:21 +02:00
2020-09-01 11:50:55 +02:00
return this.$gettext('Go on this account page')
2021-07-01 09:24:54 +02:00
},
isAccount (): boolean {
return this.type === 'account'
2020-08-27 14:44:21 +02:00
}
}
})
</script>