* feat: add next event indicator to Show Page Calendar tab Closes #4289 * feat: improve calendar animation * refactor: add some utils and fix sorting edge case with full day * refactor: rename CalendarCurrentEventIndicator to CalendarCurrentEventCursor * fix: fix tests * Fix lint --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
35 lines
963 B
TypeScript
35 lines
963 B
TypeScript
import { useContext } from 'react';
|
|
import styled from '@emotion/styled';
|
|
|
|
import { CalendarDayCardContent } from '@/activities/calendar/components/CalendarDayCardContent';
|
|
import { CalendarContext } from '@/activities/calendar/contexts/CalendarContext';
|
|
import { Card } from '@/ui/layout/card/components/Card';
|
|
|
|
type CalendarMonthCardProps = {
|
|
dayTimes: number[];
|
|
};
|
|
|
|
const StyledCard = styled(Card)`
|
|
overflow: visible;
|
|
`;
|
|
|
|
export const CalendarMonthCard = ({ dayTimes }: CalendarMonthCardProps) => {
|
|
const { calendarEventsByDayTime } = useContext(CalendarContext);
|
|
|
|
return (
|
|
<StyledCard fullWidth>
|
|
{dayTimes.map((dayTime, index) => {
|
|
const dayCalendarEvents = calendarEventsByDayTime[dayTime] || [];
|
|
|
|
return (
|
|
<CalendarDayCardContent
|
|
key={dayTime}
|
|
calendarEvents={dayCalendarEvents}
|
|
divider={index < dayTimes.length - 1}
|
|
/>
|
|
);
|
|
})}
|
|
</StyledCard>
|
|
);
|
|
};
|