fix: Text color bug on attachment bubble in widget (#6399)

* fix: Text color bug on attachment bubble

* chore: Fix file bubble text color issue

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
This commit is contained in:
Fayaz Ahmed
2023-02-09 16:50:11 +05:30
committed by GitHub
parent c5b245977a
commit e18f4aeee9
3 changed files with 20 additions and 3 deletions

View File

@@ -24,7 +24,7 @@
<div
v-if="hasAttachments"
class="chat-bubble has-attachment agent"
:class="(wrapClass, $dm('bg-white', 'dark:bg-slate-50'))"
:class="(wrapClass, $dm('bg-white', 'dark:bg-slate-700'))"
>
<div v-for="attachment in message.attachments" :key="attachment.id">
<image-bubble

View File

@@ -4,7 +4,7 @@
<fluent-icon icon="document" size="28" />
</div>
<div class="meta">
<div class="title" :style="{ color: textColor }">
<div class="title" :class="titleColor" :style="{ color: textColor }">
{{ title }}
</div>
<div class="link-wrap mb-1">
@@ -24,12 +24,14 @@
<script>
import FluentIcon from 'shared/components/FluentIcon/Index.vue';
import darkModeMixin from 'widget/mixins/darkModeMixin.js';
import { getContrastingTextColor } from '@chatwoot/utils';
export default {
components: {
FluentIcon,
},
mixins: [darkModeMixin],
props: {
url: {
type: String,
@@ -43,6 +45,10 @@ export default {
type: String,
default: '',
},
isUserBubble: {
type: Boolean,
default: false,
},
},
computed: {
title() {
@@ -53,9 +59,19 @@ export default {
fileName() {
return this.url.substring(this.url.lastIndexOf('/') + 1);
},
textColor() {
contrastingTextColor() {
return getContrastingTextColor(this.widgetColor);
},
textColor() {
return this.isUserBubble && this.widgetColor
? this.contrastingTextColor
: '';
},
titleColor() {
return !this.isUserBubble
? this.$dm('text-black-900', 'dark:text-slate-50')
: '';
},
},
methods: {
openLink() {

View File

@@ -29,6 +29,7 @@
:url="attachment.data_url"
:is-in-progress="isInProgress"
:widget-color="widgetColor"
is-user-bubble
/>
</div>
</div>