@@ -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 )) {
@@ -131,7 +140,7 @@ onBeforeMount(() => {
131140 :id =" event.id"
132141 ref =" eventRef"
133142 class =" preview-card"
134- :class =" { 'preview-card--collapsed ': isCollapsed }"
143+ :class =" { 'preview-card--deleting ': isDeleting }"
135144 >
136145 <PreviewCardHeader
137146 class =" preview-card__header"
@@ -170,16 +179,32 @@ onBeforeMount(() => {
170179</template >
171180
172181<style lang="scss" scoped>
182+ @keyframes add-event {
183+ 0% {
184+ opacity : 0 ;
185+ animation-timing-function : cubic-bezier (0.8 , 0 , 1 , 1 );
186+ pointer-events : none ; // NOTE: need to block event deleting to new events
187+ }
188+ 100% {
189+ opacity : 1 ;
190+ animation-timing-function : cubic-bezier (0.8 , 0 , 1 , 1 );
191+ pointer-events : auto ;
192+ }
193+ }
194+
173195.preview-card {
174196 @apply flex-grow flex flex-col p-2 lg :p- 3 transition- colors dark :bg- gray- 700;
175197
198+ animation : add- event 0.2s ;
176199 & :hover {
177200 @apply bg-gray-50 dark :bg- gray- 900;
178201 }
179202}
180203
181- .preview-card--collapsed {
182- // @apply shadow-bottom;
204+ .preview-card--deleting {
205+ @apply opacity-0 pointer-events-none ;
206+
207+ transition : all 0.2s cubic-bezier (0.8 , 0 , 1 , 1 );
183208}
184209
185210.preview-card__header {
@@ -188,6 +213,8 @@ onBeforeMount(() => {
188213
189214.preview-card__body {
190215 @apply flex flex-col mt-2 lg :mt- 3;
216+
217+ animation : add- event 0.2s ;
191218}
192219
193220.preview-card__footer {
0 commit comments