Robert Schäfer f5afdf2435 Merge Notification with NotificationPostCard
cc @mattwr18 Please don't see this as a revert of your work. Your
structure of the `notification-post-card` component was helpful and showed
the redundancy with `hc-post-card`. I reused a lot of the code, but
because I merged both components it now *looks* as if I authored all the code.
2019-04-17 01:10:17 +02:00

63 lines
1.4 KiB
Vue

<template>
<ds-space margin-bottom="x-small">
<no-ssr>
<ds-space margin-bottom="x-small">
<hc-user
:user="post.author"
:trunc="35"
/>
</ds-space>
<ds-text color="soft">
{{ $t("notifications.menu.mentioned") }}
</ds-text>
</no-ssr>
<ds-space margin-bottom="x-small" />
<nuxt-link
class="notification-mention-post"
:to="{ name: 'post-id-slug', params: { id: post.id, slug: post.slug } }"
@click.native="$emit('read')"
>
<ds-space margin-bottom="x-small">
<ds-card
:header="post.title"
:image="post.image"
:class="{'post-card': true, 'disabled-content': post.disabled}"
hover
space="x-small"
>
<ds-space margin-bottom="x-small" />
<!-- eslint-disable vue/no-v-html -->
<div v-html="excerpt" />
<!-- eslint-enable vue/no-v-html -->
</ds-card>
</ds-space>
</nuxt-link>
</ds-space>
</template>
<script>
import HcUser from '~/components/User'
import RemoveLinks from '~/mixins/removeLinks'
export default {
name: 'Notification',
components: {
HcUser
},
props: {
notification: {
type: Object,
required: true
}
},
computed: {
excerpt() {
return RemoveLinks.methods.removeLinks(this.post.contentExcerpt)
},
post() {
return this.notification.post || {}
}
}
}
</script>