@@ -22,6 +22,7 @@ const isOptimized = ref(false);
2222const isVisibleControls = ref (true );
2323
2424const eventRef = ref (null );
25+ const isDeleting = ref (false );
2526const { events, lockedIds } = useEvents ();
2627
2728const normalizedTags = computed (() => [
@@ -50,7 +51,15 @@ const changeVisibleControls = (value = true) => {
5051 isVisibleControls .value = value ;
5152};
5253
53- const deleteEvent = () => events ?.removeById (props .event .id );
54+ const deleteEvent = () => {
55+ isDeleting .value = true ;
56+
57+ setTimeout (() => {
58+ events ?.removeById (props .event .id );
59+
60+ isDeleting .value = false ;
61+ }, 200 );
62+ };
5463
5564const toggleEventLock = () => {
5665 if ((lockedIds ?.items .value || []).includes (props .event .id )) {
@@ -127,7 +136,12 @@ onBeforeMount(() => {
127136 </script >
128137
129138<template >
130- <div :id =" event.id" ref =" eventRef" class =" preview-card" >
139+ <div
140+ :id =" event.id"
141+ ref =" eventRef"
142+ class =" preview-card"
143+ :class =" { 'preview-card--deleting': isDeleting }"
144+ >
131145 <PreviewCardHeader
132146 class =" preview-card__header"
133147 :event-url =" eventUrl"
@@ -165,11 +179,11 @@ onBeforeMount(() => {
165179</template >
166180
167181<style lang="scss" scoped>
168- @keyframes new -event {
182+ @keyframes add -event {
169183 0% {
170184 opacity : 0 ;
171185 animation-timing-function : cubic-bezier (0.8 , 0 , 1 , 1 );
172- pointer-events : none ;
186+ pointer-events : none ; // NOTE: need to block event deleting to new events
173187 }
174188 100% {
175189 opacity : 1 ;
@@ -181,26 +195,29 @@ onBeforeMount(() => {
181195.preview-card {
182196 @apply flex-grow flex flex-col p-2 lg :p- 3 transition- colors dark :bg- gray- 700;
183197
198+ animation : add- event 0.2s ;
184199 & :hover {
185200 @apply bg-gray-50 dark :bg- gray- 900;
186201 }
187202}
188203
204+ .preview-card--deleting {
205+ @apply opacity-0 pointer-events-none ;
206+
207+ transition : all 0.2s cubic-bezier (0.8 , 0 , 1 , 1 );
208+ }
209+
189210.preview-card__header {
190211 @apply w-full flex flex-row justify-between gap-y- 3;
191-
192- animation : new- event 0.4s ;
193212}
194213
195214.preview-card__body {
196215 @apply flex flex-col mt-2 lg :mt- 3;
197216
198- animation : new - event 0.2s ;
217+ animation : add - event 0.2s ;
199218}
200219
201220.preview-card__footer {
202221 @apply w-full flex flex-row justify-between mt-1 lg :mt- 2 text- gray- 400;
203-
204- animation : new- event 0.4s ;
205222}
206223 </style >
0 commit comments