diff --git a/packages/widgets/src/calendar/calender-day.tsx b/packages/widgets/src/calendar/calender-day.tsx index 3629a937f0..790cc0a829 100644 --- a/packages/widgets/src/calendar/calender-day.tsx +++ b/packages/widgets/src/calendar/calender-day.tsx @@ -1,5 +1,6 @@ import { useState } from "react"; import { Box, Container, Flex, Popover, Text, useMantineTheme } from "@mantine/core"; +import { useElementSize } from "@mantine/hooks"; import { useRequiredBoard } from "@homarr/boards/context"; import type { CalendarEvent } from "@homarr/integrations/types"; @@ -17,6 +18,7 @@ interface CalendarDayProps { export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: CalendarDayProps) => { const [opened, setOpened] = useState(false); const { primaryColor } = useMantineTheme(); + const { ref, height } = useElementSize(); const board = useRequiredBoard(); const mantineTheme = useMantineTheme(); const actualItemRadius = mantineTheme.radius[board.itemRadius]; @@ -25,6 +27,8 @@ export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: C const shouldScaleDown = minAxisSize < 350; const isSmall = rootHeight < 256; + const isTooSmallForIndicators = height < 30; + return ( {date.getDate()} - + {!isTooSmallForIndicators && } {/* Popover has some offset on the left side, padding is removed because of scrollarea paddings */} @@ -82,9 +87,19 @@ const NotificationIndicator = ({ events, isSmall }: NotificationIndicatorProps) const notificationEvents = [...new Set(events.map((event) => event.indicatorColor))].filter(String); /* position bottom is lower when small to not be on top of number*/ return ( - + {notificationEvents.map((notificationEvent) => { - return ; + return ; })} ); diff --git a/packages/widgets/src/calendar/component.tsx b/packages/widgets/src/calendar/component.tsx index 1677b2ba29..b287d23246 100644 --- a/packages/widgets/src/calendar/component.tsx +++ b/packages/widgets/src/calendar/component.tsx @@ -124,12 +124,17 @@ const CalendarBase = ({ isEditMode, events, month, setMonth, options }: Calendar }, monthCell: { textAlign: "center", + position: "relative", }, day: { borderRadius: actualItemRadius, width: "100%", height: "100%", - position: "relative", + position: "absolute", + top: 0, + left: 0, + bottom: 0, + right: 0, }, month: { height: "100%", @@ -137,6 +142,9 @@ const CalendarBase = ({ isEditMode, events, month, setMonth, options }: Calendar weekday: { padding: 0, }, + weekdaysRow: { + height: 22, + }, }} renderDay={(tileDate) => { const eventsForDate = normalizedEvents