advent22/ui/src/components/calendar/MultiModal.vue

48 lines
1 KiB
Vue
Raw Normal View History

2022-10-30 02:35:39 +00:00
<template>
2022-12-21 23:51:01 +00:00
<div class="modal is-active" v-if="active" @click="set_active(false)">
2022-10-30 02:35:39 +00:00
<div class="modal-background" />
<div class="modal-content">
2023-09-06 18:44:19 +00:00
<template v-if="progress">
<progress class="progress is-primary" max="100" />
</template>
<template v-else>
<div class="image is-square">
<img :src="image_src" alt="Kalender-Bild" />
</div>
</template>
2022-10-30 02:35:39 +00:00
</div>
</div>
</template>
<script lang="ts">
2022-12-21 23:51:01 +00:00
import { Vue } from "vue-class-component";
2022-10-30 02:35:39 +00:00
2023-01-24 23:18:09 +00:00
export default class extends Vue {
2023-09-06 16:25:35 +00:00
public active = false;
2023-09-06 18:44:19 +00:00
public progress = false;
2022-12-21 23:51:01 +00:00
public image_src = "";
2022-10-30 02:35:39 +00:00
2023-01-17 14:28:11 +00:00
public created() {
2022-10-30 02:35:39 +00:00
window.addEventListener("keydown", (e) => {
2022-12-21 23:51:01 +00:00
if (e.key == "Escape") this.set_active(false);
2022-10-30 02:35:39 +00:00
});
}
2023-01-17 14:28:11 +00:00
public set_active(state: boolean) {
2022-12-21 23:51:01 +00:00
this.active = state;
}
2023-09-06 18:44:19 +00:00
public show_image(src: string) {
this.progress = false;
2022-12-21 23:51:01 +00:00
this.image_src = src;
2022-12-22 00:16:42 +00:00
this.set_active(true);
2022-10-30 02:35:39 +00:00
}
2023-09-06 18:44:19 +00:00
public show_progress() {
this.progress = true;
this.set_active(true);
}
2022-10-30 02:35:39 +00:00
}
</script>