@abbl/material-calendar
Version:
Calendar component build with React and Material-UI
39 lines • 1.9 kB
JavaScript
import React from 'react';
import defaultViews from '../views/DefaultViews';
import { CalendarContext } from '../common/contexts/CalendarContext';
import { EventStorageContext } from '../common/contexts/EventStorageContext';
import { ViewContext } from '../common/contexts/ViewContext';
import CalendarContextStore from '../common/hooks/context/CalendarContextStore';
import EventStorageContextStore from '../common/hooks/context/EventStorageContextStore';
import { ViewContextStore } from '../common/hooks/context/ViewContextStore';
import CalendarCore from './CalendarCore';
import useCalendarEventStorage from './components/eventStorage/useCalendarEventStorage';
/**
*/
export default function MaterialCalendar(props) {
var calendarContextStore = CalendarContextStore(getCalendarContextProps());
var eventStorageContextStore = EventStorageContextStore();
var viewContextStore = ViewContextStore(getDefaultView());
var calendarEventStorage = useCalendarEventStorage({
onDataRequest: props.onDataRequest,
viewContext: viewContextStore,
eventStorageContext: eventStorageContextStore,
});
function getCalendarContextProps() {
return {
userViews: props.views !== undefined ? props.views : defaultViews,
globalEventPopoutContent: props.globalEventPopoutContent,
};
}
function getDefaultView() {
if (props.views && props.views.length > 0) {
return props.views[0];
}
return defaultViews[0];
}
return (React.createElement(CalendarContext.Provider, { value: calendarContextStore },
React.createElement(ViewContext.Provider, { value: viewContextStore },
React.createElement(EventStorageContext.Provider, { value: eventStorageContextStore },
React.createElement(CalendarCore, null)))));
}
//# sourceMappingURL=MaterialCalendar.js.map