From 8a1f03a7b7ac9df86948c54726e65df853aecf84 Mon Sep 17 00:00:00 2001 From: itsfinniii <102350242+itsfinniii@users.noreply.github.com> Date: Mon, 23 Mar 2026 19:00:39 +0100 Subject: [PATCH] Animate the Upcoming Event component --- .../web/subcomponents/UpcomingEvent.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/astro/src/components/web/subcomponents/UpcomingEvent.tsx b/astro/src/components/web/subcomponents/UpcomingEvent.tsx index 52b3a36..9bb9f39 100644 --- a/astro/src/components/web/subcomponents/UpcomingEvent.tsx +++ b/astro/src/components/web/subcomponents/UpcomingEvent.tsx @@ -3,23 +3,30 @@ import { useEffect, useState } from "preact/hooks" export function upcomingEvent(props: { event: UpcomingEvent }) { const [ isOpen, setIsOpen ] = useState(false); + const [ isVisible, setIsVisible ] = useState(false); - useEffect(() => { - console.log(isOpen); - }, [ isOpen ]) + const open = () => { + setIsOpen(true); + setTimeout(() => setIsVisible(true), 10); // allow DOM mount + }; + + const close = () => { + setIsVisible(false); + setTimeout(() => setIsOpen(false), 200); // match animation duration + }; return (
-
setIsOpen(true)}>{"Read more >>"}
+
{"Read more >>"}
{ isOpen && (
setIsOpen(false)} - className="fixed inset-0 flex items-center justify-center bg-[#000000bb] shadow-md z-999999999999" + onClick={close} + className={`fixed inset-0 flex items-center justify-center bg-[#000000bb] shadow-md z-999999999999 duration-200 ${isVisible ? "opacity-100" : "opacity-0"}`} >
e.stopPropagation()} - className="relative bg-white rounded-2xl shadow-xl max-w-md w-full p-6 animate-in fade-in zoom-in-95" + className={`relative bg-white rounded-2xl shadow-xl max-w-md w-full p-6 transition-all duration-200 ${isVisible ? "opacity-100 scale-100" : "opacity-0 scale-95"}`} >

{props.event.title}