2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-07-04 06:00:38 +00:00

[UI] Calendar month colors (#12157)

Discriminate months which slightly different colors
This commit is contained in:
Oliver
2026-06-13 19:56:40 +10:00
committed by GitHub
parent 10479e82b8
commit e4178b1fb8
2 changed files with 33 additions and 0 deletions
@@ -1,6 +1,7 @@
import type {
CalendarOptions,
DatesSetArg,
DayCellContentArg,
EventContentArg
} from '@fullcalendar/core';
import allLocales from '@fullcalendar/core/locales-all';
@@ -182,6 +183,25 @@ export default function Calendar({
[calendarProps.eventContent, eventTooltipContent]
);
const monthDayCellClassNames = useCallback(
(arg: DayCellContentArg): string[] => {
const monthClass =
arg.date.getMonth() % 2 === 0
? 'fc-day-month-even'
: 'fc-day-month-odd';
const existing = calendarProps.dayCellClassNames;
if (!existing) return [monthClass];
if (typeof existing === 'function') {
const result = existing(arg);
const arr = Array.isArray(result) ? result : result ? [result] : [];
return [monthClass, ...arr];
}
if (Array.isArray(existing)) return [monthClass, ...existing];
return [monthClass, existing as string];
},
[calendarProps.dayCellClassNames]
);
return (
<>
{state.exportModal.modal}
@@ -309,6 +329,11 @@ export default function Calendar({
{...calendarProps}
datesSet={datesSet}
eventContent={wrappedEventContent}
dayCellClassNames={
isScrollView
? monthDayCellClassNames
: calendarProps.dayCellClassNames
}
/>
</Box>
</Stack>
+8
View File
@@ -3,6 +3,14 @@
padding: 0.35em 0;
}
/* Alternating month backgrounds in the multi-month scroll calendar view */
[data-mantine-color-scheme='light'] .fc-day-month-odd:not(.fc-day-today) {
background-color: var(--mantine-color-gray-1);
}
[data-mantine-color-scheme='dark'] .fc-day-month-odd:not(.fc-day-today) {
background-color: var(--mantine-color-dark-4);
}
/* mantine-datatable overrides */
.mantine-datatable-pointer-cursor,
.mantine-datatable-context-menu-cursor {