egirlskey/packages/frontend/src/components/MkSubNoteContent.vue

91 lines
2.1 KiB
Vue
Raw Normal View History

<template>
<div class="wrmlmaau" :class="{ collapsed }">
<div class="body">
2022-07-20 13:24:26 +00:00
<span v-if="note.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
<span v-if="note.deletedAt" style="opacity: 0.5">({{ i18n.ts.deleted }})</span>
<MkA v-if="note.replyId" class="reply" :to="`/notes/${note.replyId}`"><i class="ti ti-arrow-back-up"></i></MkA>
2023-01-08 01:48:44 +00:00
<Mfm v-if="note.text" v-once :text="note.text" :author="note.user" :i="$i"/>
2021-11-19 10:36:12 +00:00
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
</div>
<details v-if="note.files.length > 0">
<summary>({{ $t('withNFiles', { n: note.files.length }) }})</summary>
2022-12-30 04:56:22 +00:00
<MkMediaList :media-list="note.files"/>
</details>
<details v-if="note.poll">
2022-07-20 13:24:26 +00:00
<summary>{{ i18n.ts.poll }}</summary>
2022-12-30 04:56:22 +00:00
<MkPoll :note="note"/>
</details>
<button v-if="collapsed" class="fade _button" @click="collapsed = false">
2022-07-20 13:24:26 +00:00
<span>{{ i18n.ts.showMore }}</span>
</button>
</div>
</template>
<script lang="ts" setup>
import { } from 'vue';
2022-07-20 13:24:26 +00:00
import * as misskey from 'misskey-js';
2022-12-30 04:56:22 +00:00
import MkMediaList from '@/components/MkMediaList.vue';
import MkPoll from '@/components/MkPoll.vue';
2022-07-20 13:24:26 +00:00
import { i18n } from '@/i18n';
const props = defineProps<{
note: misskey.entities.Note;
}>();
const collapsed = $ref(
props.note.cw == null && props.note.text != null && (
(props.note.text.split('\n').length > 9) ||
(props.note.text.length > 500)
));
</script>
<style lang="scss" scoped>
.wrmlmaau {
overflow-wrap: break-word;
> .body {
> .reply {
margin-right: 6px;
color: var(--accent);
}
> .rp {
margin-left: 4px;
font-style: oblique;
color: var(--renote);
}
}
&.collapsed {
position: relative;
max-height: 9em;
overflow: clip;
> .fade {
display: block;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 64px;
background: linear-gradient(0deg, var(--panel), var(--X15));
> span {
display: inline-block;
background: var(--panel);
padding: 6px 10px;
font-size: 0.8em;
border-radius: 999px;
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
}
&:hover {
> span {
background: var(--panelHighlight);
}
}
}
}
}
</style>