2018-07-11 18:00:12 +00:00
|
|
|
<template>
|
|
|
|
<button
|
2018-09-24 10:41:56 +00:00
|
|
|
v-if="link.type !== 'loading'"
|
2018-07-12 08:26:12 +00:00
|
|
|
:class="['toggle-button', 'toggle-preview', { opened: link.shown }]"
|
2019-03-13 17:08:32 +00:00
|
|
|
:aria-label="ariaLabel"
|
2019-02-25 05:38:13 +00:00
|
|
|
@click="onClick"
|
|
|
|
/>
|
2018-07-11 18:00:12 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: "LinkPreviewToggle",
|
|
|
|
props: {
|
|
|
|
link: Object,
|
|
|
|
},
|
2019-03-13 17:08:32 +00:00
|
|
|
computed: {
|
|
|
|
ariaLabel() {
|
|
|
|
return this.link.shown ? "Collapse preview" : "Expand preview";
|
|
|
|
},
|
|
|
|
},
|
2018-07-11 18:00:12 +00:00
|
|
|
methods: {
|
2018-07-12 08:26:12 +00:00
|
|
|
onClick() {
|
2018-07-11 18:00:12 +00:00
|
|
|
this.link.shown = !this.link.shown;
|
|
|
|
|
2018-07-11 20:45:01 +00:00
|
|
|
this.$parent.$emit("linkPreviewToggle", this.link, this.$parent.message);
|
2018-07-12 08:26:12 +00:00
|
|
|
},
|
|
|
|
},
|
2018-07-11 18:00:12 +00:00
|
|
|
};
|
|
|
|
</script>
|