UNPKG

@abbl/material-calendar

Version:

Calendar component build with React and Material-UI

24 lines 1.2 kB
import React, { useContext } from 'react'; import { EventStorageContext } from '../../common/contexts/EventStorageContext'; import { ViewContext } from '../../common/contexts/ViewContext'; import CalendarEventUtils from '../../common/tools/CalendarEventUtils'; import DayContent from './components/dayContent/DayContent'; import DayHeader from './components/dayHeader/DayHeader'; export default function DayView() { var eventStorageContext = useContext(EventStorageContext); var viewContext = useContext(ViewContext); /** * Loads events from EventStorage based on highlightDate. * * If there is no events for that day function will * return empty array. */ function getEvents() { var dayEvents = CalendarEventUtils.getDayEvents(eventStorageContext.eventStorage, viewContext.highlightDate); return dayEvents ? dayEvents : []; } return (React.createElement("div", null, React.createElement(DayHeader, { highlightDate: viewContext.highlightDate, headerContentLeftOffset: 56 }), React.createElement(DayContent, { events: getEvents(), highlightDate: viewContext.highlightDate }))); } //# sourceMappingURL=DayView.js.map