1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-21 01:59:01 +09:00
cherrypick/src/client/app/desktop/views/widgets/channel.channel.post.vue

72 lines
1.3 KiB
Vue
Raw Normal View History

2018-02-21 15:30:03 +09:00
<template>
<div class="post">
<header>
<a class="index" @click="reply">{{ post.index }}:</a>
2018-03-27 16:51:12 +09:00
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.user.id"><b>{{ post.user.name }}</b></router-link>
<span>ID:<i>{{ acct }}</i></span>
2018-02-21 15:30:03 +09:00
</header>
<div>
<a v-if="post.reply">&gt;&gt;{{ post.reply.index }}</a>
{{ post.text }}
<div class="media" v-if="post.media">
<a v-for="file in post.media" :href="file.url" target="_blank">
<img :src="`${file.url}?thumbnail&size=512`" :alt="file.name" :title="file.name"/>
</a>
</div>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
2018-04-02 13:44:32 +09:00
import getAcct from '../../../../../acct/render';
2018-03-27 16:51:12 +09:00
2018-02-21 15:30:03 +09:00
export default Vue.extend({
props: ['post'],
2018-03-27 16:51:12 +09:00
computed: {
acct() {
return getAcct(this.post.user);
}
},
2018-02-21 15:30:03 +09:00
methods: {
reply() {
this.$emit('reply', this.post);
}
}
});
</script>
<style lang="stylus" scoped>
.post
margin 0
padding 0
color #444
> header
position -webkit-sticky
position sticky
z-index 1
top 0
padding 8px 4px 4px 16px
background rgba(255, 255, 255, 0.9)
> .index
margin-right 0.25em
> .name
margin-right 0.5em
color #008000
> div
padding 0 16px 16px 16px
> .media
> a
display inline-block
> img
max-width 100%
vertical-align bottom
</style>