Chatwoot/app/javascript/widget/components/ImageBubble.vue
Nithin David Thomas 307118b235
feat: Shows error message with retry for widget messages (#3594)
- Adds error message retry option for widget bubbles
- Adds a fallback for widget images with file type bubble
2021-12-21 12:02:43 +05:30

71 lines
1.2 KiB
Vue

<template>
<a
:href="url"
target="_blank"
rel="noreferrer noopener nofollow"
class="image"
>
<div class="wrap">
<img
:src="thumb"
alt="Picture message"
@click="onClick"
@error="onImgError"
/>
<span class="time">{{ readableTime }}</span>
</div>
</a>
</template>
<script>
export default {
props: ['url', 'thumb', 'readableTime'],
methods: {
onImgError() {
this.$emit('error');
},
},
};
</script>
<style lang="scss" scoped>
@import '~widget/assets/scss/variables.scss';
.image {
display: block;
.wrap {
position: relative;
display: flex;
max-width: 100%;
&::before {
background-image: linear-gradient(
-180deg,
transparent 3%,
$color-heading 130%
);
bottom: 0;
content: '';
height: 20%;
left: 0;
opacity: 0.8;
position: absolute;
width: 100%;
}
}
img {
width: 100%;
max-width: 250px;
}
.time {
font-size: $font-size-small;
bottom: $space-smaller;
color: $color-white;
position: absolute;
right: $space-slab;
white-space: nowrap;
}
}
</style>