1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-18 00:28:16 +09:00
hotomoe/src/client/app/mobile/views/components/note-card.vue

94 lines
1.6 KiB
Vue
Raw Normal View History

2018-02-15 18:33:34 +09:00
<template>
2018-04-08 02:30:37 +09:00
<div class="mk-note-card">
<a :href="`/@${acct}/${note.id}`">
2018-02-15 18:33:34 +09:00
<header>
2018-04-06 01:36:34 +09:00
<img :src="`${acct}?thumbnail&size=64`" alt="avatar"/><h3>{{ name }}</h3>
2018-02-15 18:33:34 +09:00
</header>
<div>
{{ text }}
</div>
2018-04-08 02:30:37 +09:00
<mk-time :time="note.createdAt"/>
2018-02-15 18:33:34 +09:00
</a>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
2018-04-08 02:30:37 +09:00
import summary from '../../../../../renderers/get-note-summary';
2018-04-02 13:44:32 +09:00
import getAcct from '../../../../../acct/render';
2018-04-06 01:36:34 +09:00
import getUserName from '../../../../../renderers/get-user-name';
2018-02-15 18:33:34 +09:00
export default Vue.extend({
2018-04-08 02:30:37 +09:00
props: ['note'],
2018-02-15 18:33:34 +09:00
computed: {
2018-03-27 16:51:12 +09:00
acct() {
2018-04-08 02:30:37 +09:00
return getAcct(this.note.user);
2018-03-27 16:51:12 +09:00
},
2018-04-06 01:36:34 +09:00
name() {
2018-04-08 02:30:37 +09:00
return getUserName(this.note.user);
2018-04-06 01:36:34 +09:00
},
2018-02-15 18:33:34 +09:00
text(): string {
2018-04-08 02:30:37 +09:00
return summary(this.note);
2018-02-15 18:33:34 +09:00
}
}
});
</script>
<style lang="stylus" scoped>
2018-04-08 02:30:37 +09:00
.mk-note-card
2018-02-15 18:33:34 +09:00
display inline-block
width 150px
//height 120px
font-size 12px
background #fff
border-radius 4px
> a
display block
color #2c3940
&:hover
text-decoration none
> header
> img
position absolute
top 8px
left 8px
width 28px
height 28px
border-radius 6px
> h3
display inline-block
overflow hidden
width calc(100% - 45px)
margin 8px 0 0 42px
line-height 28px
white-space nowrap
text-overflow ellipsis
font-size 12px
> div
padding 2px 8px 8px 8px
height 60px
overflow hidden
white-space normal
&:after
content ""
display block
position absolute
top 40px
left 0
width 100%
height 20px
background linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #fff 100%)
2018-02-17 03:01:00 +09:00
> .mk-time
2018-02-15 18:33:34 +09:00
display inline-block
padding 8px
color #aaa
</style>