feat: show translate below content (#185)

This commit is contained in:
Shinigami 2022-11-27 17:54:11 +01:00 committed by GitHub
parent 729b36a606
commit 72d40edbb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,17 +6,20 @@ const { status, withAction = true } = defineProps<{
withAction?: boolean withAction?: boolean
}>() }>()
const { translation } = useTranslation(status) const { translation } = useTranslation(status)
const content = $computed(() => translation.visible ? translation.text : status.content)
</script> </script>
<template> <template>
<div class="status-body" whitespace-pre-wrap break-words :class="{ 'with-action': withAction }"> <div class="status-body" whitespace-pre-wrap break-words :class="{ 'with-action': withAction }">
<ContentRich <ContentRich
v-if="content" v-if="status.content"
:content="content" :content="status.content"
:emojis="status.emojis" :emojis="status.emojis"
/> />
<div v-else h-3 /> <div v-else h-3 />
<template v-if="translation.visible">
<div my2 h-px border="b base" bg-base />
<ContentRich :content="translation.text" :emojis="status.emojis" />
</template>
</div> </div>
</template> </template>