Files
chatwoot/app/javascript/widget/components/ImageBubble.vue
Shivam Mishra c51a458c25 style: apply fixes for eslint issues [cw-3590] (#10210)
These fixes are all auto generated and can be merged directly

Fixes the following issues

1. Event used on components should be hypenated
2. Attribute orders in components
3. Use `unmounted` instead of `destroyed`
4. Add explicit `emits` declarations for components, autofixed [using
this
script](https://gist.github.com/scmmishra/6f549109b96400006bb69bbde392eddf)


We ignore the top level v-if for now, we will fix it later
2024-10-03 15:02:12 +05:30

73 lines
1.2 KiB
Vue

<script>
export default {
props: {
url: { type: String, default: '' },
thumb: { type: String, default: '' },
readableTime: { type: String, default: '' },
},
emits: ['error'],
methods: {
onImgError() {
this.$emit('error');
},
},
};
</script>
<template>
<a
:href="url"
target="_blank"
rel="noreferrer noopener nofollow"
class="image"
>
<div class="wrap">
<img :src="thumb" alt="Picture message" @error="onImgError" />
<span class="time">{{ readableTime }}</span>
</div>
</a>
</template>
<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>