File tree Expand file tree Collapse file tree 2 files changed +73
-1
lines changed
Expand file tree Collapse file tree 2 files changed +73
-1
lines changed Original file line number Diff line number Diff line change 1+ <script lang="ts" setup>
2+ import type { Message } from ' ../composables/use-toaster'
3+
4+ defineProps <{ messages: Message [] }>()
5+
6+ const emit = defineEmits <{
7+ ' close-message' : [id : string ]
8+ }>()
9+
10+ const close = (id : string ) => emit (' close-message' , id )
11+ </script >
12+
13+ <template >
14+ <div class =" toaster-container" >
15+ <TransitionGroup
16+ mode =" out-in"
17+ name =" list"
18+ tag =" div"
19+ class =" toasters"
20+ >
21+ <template
22+ v-for =" message in messages "
23+ :key =" message .id "
24+ >
25+ <DsfrAlert
26+ class =" app-alert"
27+ v-bind =" message"
28+ @close =" close(message.id as string)"
29+ />
30+ </template >
31+ </TransitionGroup >
32+ </div >
33+ </template >
34+
35+ <style scoped>
36+ .toaster-container {
37+ pointer-events : none ;
38+ position : fixed ;
39+ bottom : 1rem ;
40+ width : 100% ;
41+ z-index : 1750 ; /* To be on top of .fr-modal which has z-index: 1750 */
42+ }
43+ .toasters {
44+ display : flex ;
45+ flex-direction : column ;
46+ align-items : center ;
47+ }
48+
49+ .app-alert {
50+ background-color : var (--grey-1000-50 );
51+ width : 90% ;
52+ pointer-events : all ;
53+ }
54+
55+ .list-move , /* apply transition to moving elements */
56+ .list-enter-active ,
57+ .list-leave-active {
58+ transition : all 0.5s ease ;
59+ }
60+
61+ .list-enter-from ,
62+ .list-leave-to {
63+ opacity : 0 ;
64+ transform : translateY (30px );
65+ }
66+
67+ /* ensure leaving items are taken out of layout flow so that moving
68+ animations can be calculated correctly. */
69+ .list-leave-active {
70+ position : fixed ;
71+ }
72+ </style >
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ import { VitePWA } from 'vite-plugin-pwa'
88import AutoImport from 'unplugin-auto-import/vite'
99import Components from 'unplugin-vue-components/vite'
1010import {
11- vueDsfrAutoimportPreset ,
1211 ohVueIconAutoimportPreset ,
12+ vueDsfrAutoimportPreset ,
1313 vueDsfrComponentResolver ,
1414} from '@gouvminint/vue-dsfr'
1515
You can’t perform that action at this time.
0 commit comments