feat: display read more if content height is more than ideal height
This commit is contained in:
parent
fb411e89f4
commit
03c3bc411d
1 changed files with 14 additions and 1 deletions
|
@ -13,6 +13,13 @@ const {
|
||||||
|
|
||||||
const { translation } = useTranslation(status, getLanguageCode())
|
const { translation } = useTranslation(status, getLanguageCode())
|
||||||
|
|
||||||
|
const idealHeight = window.screen.height * 0.6
|
||||||
|
const root = ref<HTMLElement | null>(null)
|
||||||
|
const { height } = useElementSize(root)
|
||||||
|
const doCollapseLongStatus = ref(false)
|
||||||
|
|
||||||
|
onMounted(() => doCollapseLongStatus.value = height.value > idealHeight)
|
||||||
|
|
||||||
const emojisObject = useEmojisFallback(() => status.emojis)
|
const emojisObject = useEmojisFallback(() => status.emojis)
|
||||||
const vnode = computed(() => {
|
const vnode = computed(() => {
|
||||||
if (!status.content)
|
if (!status.content)
|
||||||
|
@ -29,7 +36,9 @@ const vnode = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="status-body" whitespace-pre-wrap break-words :class="{ 'with-action': withAction }" relative>
|
<div
|
||||||
|
ref="root" class="status-body" whitespace-pre-wrap break-words :class="{ 'with-action': withAction }" relative
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
v-if="status.content"
|
v-if="status.content"
|
||||||
class="content-rich line-compact" dir="auto"
|
class="content-rich line-compact" dir="auto"
|
||||||
|
@ -45,6 +54,10 @@ const vnode = computed(() => {
|
||||||
Error: {{ translation.error }}
|
Error: {{ translation.error }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<button v-if="doCollapseLongStatus" btn-solid rounded-3 hover:bg-active cursor-pointer href="#">
|
||||||
|
Read more
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue