Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Toasts.vue « Components « vue « src - github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b06b396d923bff39fd374a981f14ca9e9a543fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
    <div class="toast-container">
        <transition-group name="toast" tag="div" appear>
            <toast :toast="toast" v-on:choose="onChoose(toast, $event)" v-for="toast in toasts" :key="toast.getId()"/>
        </transition-group>
    </div>
</template>

<script>
    import Toast from '@vue/Components/Toast/Toast';
    import ToastService from '@js/Services/ToastService';

    export default {
        components: {Toast},
        props     : {
            toasts: {
                type     : Array,
                'default': () => {
                    return [];
                }
            }
        },

        methods: {
            /**
             * @param {Toast} toast
             * @param $event
             */
            onChoose(toast, $event) {
                ToastService.choose(toast.getId(), $event);
            }
        }
    };
</script>

<style lang="scss">
    .toast-container {
        position : absolute;
        right    : 0;
        bottom   : 0;
        left     : 0;
        overflow : hidden;

        .toast-leave-active {
            animation : toast-leave .5s;
        }

        .toast-enter-active {
            animation : toast-enter .5s ease-in;
        }

        @keyframes toast-enter {
            0% {
                max-height : 0;
            }
            100% {
                max-height : 100vh;
            }
        }

        @keyframes toast-leave {
            0% {
                opacity    : 1;
                max-height : 100vh;
            }
            100% {
                opacity    : 0;
                max-height : 0;
            }
        }
    }

    @media (min-width : 361px) {
        #options {
            .toast-container {
                left  : auto;
                width : 50vw;
            }
        }
    }
</style>