2020-04-02 06:58:38 +00:00
|
|
|
<template>
|
|
|
|
<div class="file message-text__wrap" @click="openLink">
|
|
|
|
<div class="icon-wrap">
|
|
|
|
<i class="ion-document-text"></i>
|
|
|
|
</div>
|
|
|
|
<div class="meta">
|
|
|
|
<div class="title">
|
|
|
|
{{ title }}
|
|
|
|
</div>
|
|
|
|
<div class="link-wrap">
|
|
|
|
<a
|
|
|
|
class="download"
|
|
|
|
rel="noreferrer noopener nofollow"
|
|
|
|
target="_blank"
|
|
|
|
:href="url"
|
|
|
|
>
|
|
|
|
{{ $t('COMPONENTS.FILE_BUBBLE.DOWNLOAD') }}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
url: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
isInProgress: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
title() {
|
|
|
|
return this.isInProgress
|
|
|
|
? this.$t('COMPONENTS.FILE_BUBBLE.UPLOADING')
|
|
|
|
: decodeURI(this.fileName);
|
|
|
|
},
|
|
|
|
fileName() {
|
|
|
|
const filename = this.url.substring(this.url.lastIndexOf('/') + 1);
|
|
|
|
return filename;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
openLink() {
|
|
|
|
const win = window.open(this.url, '_blank');
|
|
|
|
win.focus();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import '~widget/assets/scss/variables.scss';
|
|
|
|
|
|
|
|
.file {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
2020-05-02 04:17:36 +00:00
|
|
|
padding: $space-slab;
|
2020-04-02 06:58:38 +00:00
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
.icon-wrap {
|
2020-05-02 04:17:36 +00:00
|
|
|
font-size: $font-size-mega;
|
2020-04-02 06:58:38 +00:00
|
|
|
color: $color-woot;
|
|
|
|
line-height: 1;
|
|
|
|
margin-left: $space-smaller;
|
|
|
|
margin-right: $space-small;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
font-weight: $font-weight-medium;
|
2020-05-02 04:17:36 +00:00
|
|
|
font-size: $font-size-default;
|
2020-04-02 06:58:38 +00:00
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.download {
|
2020-05-02 04:17:36 +00:00
|
|
|
color: $color-woot;
|
|
|
|
font-weight: $font-weight-medium;
|
|
|
|
font-size: $font-size-mini;
|
2020-04-02 06:58:38 +00:00
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
font-size: $font-size-small;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.link-wrap {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
|
|
|
.meta {
|
|
|
|
padding-right: $space-smaller;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|