This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/client/components/LinkPreviewToggle.vue
2020-11-01 22:46:04 +00:00

30 lines
540 B
Vue

<template>
<button
v-if="link.type !== 'loading'"
:class="['toggle-button', 'toggle-preview', {opened: link.shown}]"
:aria-label="ariaLabel"
@click="onClick"
/>
</template>
<script>
export default {
name: "LinkPreviewToggle",
props: {
link: Object,
},
computed: {
ariaLabel() {
return this.link.shown ? "Collapse preview" : "Expand preview";
},
},
methods: {
onClick() {
this.link.shown = !this.link.shown;
this.$parent.$emit("toggle-link-preview", this.link, this.$parent.message);
},
},
};
</script>