Skip to content

Commit 1a58fb8

Browse files
committed
fix(EventPopup): enhance arrow styling and transition effects for improved popup appearance
1 parent a8d6ff1 commit 1a58fb8

2 files changed

Lines changed: 65 additions & 22 deletions

File tree

src/assets/scss/components/_event-popup.scss

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,48 @@
2323

2424
.event-popup__arrow {
2525
position: absolute;
26-
width: 0;
27-
height: 0;
28-
border-left: 8px solid transparent;
29-
border-right: 8px solid transparent;
30-
border-bottom: 10px solid var(--bg-color-alt, #fff);
31-
top: -10px;
26+
width: 24px;
27+
height: 16px;
28+
left: calc(50% - 12px);
29+
top: -8px;
30+
pointer-events: none;
3231
transform-origin: center;
33-
filter: drop-shadow(0 10px 18px rgba(16, 24, 40, 0.08));
34-
transform: translateY(8px);
3532
opacity: 0;
33+
34+
&::before {
35+
content: "";
36+
position: absolute;
37+
left: 0;
38+
top: 0;
39+
width: 0;
40+
height: 0;
41+
border-left: 12px solid transparent;
42+
border-right: 12px solid transparent;
43+
border-bottom: 12px solid rgba(0, 0, 0, 0.06); /* border/outline color */
44+
filter: drop-shadow(0 8px 16px rgba(16, 24, 40, 0.06));
45+
}
46+
47+
&::after {
48+
content: "";
49+
position: absolute;
50+
left: 1px;
51+
top: 1px;
52+
width: 0;
53+
height: 0;
54+
border-left: 11px solid transparent;
55+
border-right: 11px solid transparent;
56+
border-bottom: 11px solid var(--bg-color-alt, #fff); /* match popup */
57+
}
58+
59+
transform: translateY(8px);
60+
transition:
61+
transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
62+
opacity 180ms ease !important;
63+
}
64+
65+
&.is-mounted .event-popup__arrow {
66+
opacity: 1;
67+
transform: translateY(0);
3668
transition:
3769
transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
3870
opacity 180ms ease !important;
@@ -49,9 +81,15 @@
4981
&.event-popup--above {
5082
.event-popup__arrow {
5183
top: auto;
52-
bottom: -10px;
53-
border-bottom: 0;
54-
border-top: 10px solid var(--bg-color-alt, #fff);
84+
bottom: -8px;
85+
&::before {
86+
border-bottom: 0;
87+
border-top: 12px solid rgba(0, 0, 0, 0.06);
88+
}
89+
&::after {
90+
border-bottom: 0;
91+
border-top: 11px solid var(--bg-color-alt, #fff);
92+
}
5593
transform-origin: bottom center;
5694
}
5795
}

src/components/EventPopup.jsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,28 @@ const EventPopup = ({ visible, anchorRect, date, event, onClose }) => {
4444
if (visible) {
4545
setMounted(true);
4646

47-
const t1 = setTimeout(() => setIsOpen(true), 12);
47+
const enter = setTimeout(() => setIsOpen(true), 16);
4848

4949
justOpenedRef.current = true;
50-
const t2 = setTimeout(() => (justOpenedRef.current = false), 140);
50+
const guard = setTimeout(
51+
() => (justOpenedRef.current = false),
52+
160
53+
);
54+
5155
return () => {
52-
clearTimeout(t1);
53-
clearTimeout(t2);
56+
clearTimeout(enter);
57+
clearTimeout(guard);
5458
};
5559
}
5660

5761
setIsOpen(false);
58-
59-
const t = setTimeout(() => setMounted(false), 300);
60-
return () => clearTimeout(t);
62+
const leave = setTimeout(() => setMounted(false), 340);
63+
return () => clearTimeout(leave);
6164
}, [visible]);
6265

6366
if (!mounted || !anchorRect) return null;
6467

65-
const defaultWidth = Math.min(380, Math.max(300, anchorRect?.width || 320));
66-
const popupPadding = 12;
68+
const defaultWidth = Math.min(420, Math.max(300, anchorRect?.width || 320));
6769

6870
let left =
6971
anchorRect.left +
@@ -113,12 +115,15 @@ const EventPopup = ({ visible, anchorRect, date, event, onClose }) => {
113115
role="dialog"
114116
aria-modal="false"
115117
>
116-
<div className="event-popup__arrow" style={{ left: arrowLeft }} />
118+
<div
119+
className="event-popup__arrow"
120+
style={{ left: arrowLeft }}
121+
aria-hidden
122+
/>
117123
<div
118124
className={`event-popup__content ${isOpen ? "is-open" : ""}`}
119125
style={{ transformOrigin }}
120126
>
121-
{/* close button removed — using outside click / Escape to close */}
122127
<div className="event-popup__header">
123128
<div className="event-popup__header-left">
124129
{event && (

0 commit comments

Comments
 (0)