This repository was archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlerts.vue
101 lines (88 loc) · 1.61 KB
/
Alerts.vue
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<style lang="scss">
.alerts {
position: fixed;
right: 10px;
top: 66px;
width: 350px;
z-index: 40;
}
.alert {
border-radius: 6px;
box-shadow: -1px 1px 4px rgba(0, 0, 0, 0.3);
margin-bottom: 10px;
padding: 10px;
color: #fff;
display: flex;
flex-direction: column;
position: relative;
&.error {
background-color: #c1666b;
}
&.success {
background-color: #4dc0b5;
}
&.info {
background-color: #4281a4;
}
&.warning {
background-color: #d4b483;
}
&-heading {
font-weight: bold;
font-size: 18px;
text-transform: uppercase;
margin: 0 0 4px;
}
&-text {
font-weight: bold;
font-size: 14px;
}
&-close {
position: absolute;
top: 5px;
right: 5px;
background: none;
border: none;
font-size: 26px;
line-height: 26px;
&:hover {
color: rgba(0, 0, 0, 0.5);
}
&:focus {
outline: none;
}
}
}
.alert-animation-enter-active {
transition: all 0.3s ease;
}
.alert-animation-leave-active {
transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
}
.alert-animation-enter,
.alert-animation-leave-to {
transform: translateX(10px);
opacity: 0;
}
</style>
<template>
<div class="alerts">
<transition-group name="alert-animation">
<alert :alert="alert" :key="alert.id" v-for="alert in alerts"></alert>
</transition-group>
</div>
</template>
<script lang="ts">
import Vue from "vue";
import alert from "./components/Alert.vue";
export default Vue.extend({
components: {
alert,
},
computed: {
alerts() {
return this.$store.state.varie.alerts.alerts;
},
},
});
</script>