fix(widgets): fix missing event dots and instant open in calendar
- Move useElementSize ref to wrapper div so HoverCard.Target's ref merging doesn't break element measurement (dots were hidden because height returned 0, triggering isTooSmallForIndicators) - Add pos='relative' to Container so NotificationIndicator anchors to the day cell - Add openDelay/closeDelay directly to each HoverCard as fallback in case HoverCard.Group context doesn't propagate through Mantine Calendar's internal rendering
This commit is contained in:
1 parent
2e20fd7da5
commit
c08054736e
1 file changed
+38
-34
@@ -27,40 +27,44 @@ export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: C
|
|||||||
const isTooSmallForIndicators = height < 30;
|
const isTooSmallForIndicators = height < 30;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HoverCard
|
<div ref={ref} style={{ width: "100%", height: "100%" }}>
|
||||||
position="bottom"
|
<HoverCard
|
||||||
withArrow
|
position="bottom"
|
||||||
withinPortal
|
withArrow
|
||||||
radius="lg"
|
withinPortal
|
||||||
shadow="sm"
|
radius="lg"
|
||||||
transitionProps={{ transition: "pop" }}
|
shadow="sm"
|
||||||
disabled={disabled}
|
transitionProps={{ transition: "pop" }}
|
||||||
>
|
openDelay={350}
|
||||||
<HoverCard.Target>
|
closeDelay={200}
|
||||||
<Container
|
disabled={disabled}
|
||||||
h="100%"
|
>
|
||||||
w="100%"
|
<HoverCard.Target>
|
||||||
p={0}
|
<Container
|
||||||
pt={isSmall ? 0 : 10}
|
h="100%"
|
||||||
pb={isSmall ? 0 : 10}
|
w="100%"
|
||||||
m={0}
|
p={0}
|
||||||
ref={ref}
|
pt={isSmall ? 0 : 10}
|
||||||
style={{
|
pb={isSmall ? 0 : 10}
|
||||||
alignContent: "center",
|
m={0}
|
||||||
borderRadius: actualItemRadius,
|
pos="relative"
|
||||||
cursor: disabled ? "default" : "pointer",
|
style={{
|
||||||
}}
|
alignContent: "center",
|
||||||
>
|
borderRadius: actualItemRadius,
|
||||||
<Text ta={"center"} size={shouldScaleDown ? "xs" : "md"} lh={1}>
|
cursor: disabled ? "default" : "pointer",
|
||||||
{date.getDate()}
|
}}
|
||||||
</Text>
|
>
|
||||||
{!isTooSmallForIndicators && <NotificationIndicator events={events} isSmall={isSmall} />}
|
<Text ta={"center"} size={shouldScaleDown ? "xs" : "md"} lh={1}>
|
||||||
</Container>
|
{date.getDate()}
|
||||||
</HoverCard.Target>
|
</Text>
|
||||||
<HoverCard.Dropdown maw="calc(100vw - 24px)" w={512} pe={4} pb={0} style={{ overflow: "hidden" }}>
|
{!isTooSmallForIndicators && <NotificationIndicator events={events} isSmall={isSmall} />}
|
||||||
<CalendarEventList events={events} />
|
</Container>
|
||||||
</HoverCard.Dropdown>
|
</HoverCard.Target>
|
||||||
</HoverCard>
|
<HoverCard.Dropdown maw="calc(100vw - 24px)" w={512} pe={4} pb={0} style={{ overflow: "hidden" }}>
|
||||||
|
<CalendarEventList events={events} />
|
||||||
|
</HoverCard.Dropdown>
|
||||||
|
</HoverCard>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user