Created
November 8, 2020 03:20
-
-
Save Buom01/1b814bce259f47afd91dd77716092f32 to your computer and use it in GitHub Desktop.
@fullcalendar for preact, based on `@fullcalendar/react`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { h, Component } from 'preact'; | |
| import '@fullcalendar/core/vdom.js'; | |
| import { | |
| CalendarApi, CalendarDataProvider, | |
| CalendarContent, CalendarRoot | |
| } from '@fullcalendar/common'; | |
| export default class FullCalendar extends Component | |
| { | |
| constructor() { | |
| super(...arguments); | |
| this._calendarApi = new CalendarApi(); | |
| } | |
| render() { | |
| return ( | |
| <CalendarDataProvider optionOverrides={this.props} calendarApi={this._calendarApi}> | |
| {(data) => ( | |
| <CalendarRoot options={data.calendarOptions} theme={data.theme} emitter={data.emitter}> | |
| {(classNames, height, isHeightAuto, forPrint) => ( | |
| <div className={classNames.join(' ')} style={{ height }}> | |
| <CalendarContent | |
| isHeightAuto={isHeightAuto} | |
| forPrint={forPrint} | |
| {...data} | |
| /> | |
| </div> | |
| )} | |
| </CalendarRoot> | |
| )} | |
| </CalendarDataProvider> | |
| ) | |
| } | |
| getApi() { | |
| return this._calendarApi; | |
| } | |
| } | |
| // export all important utils/types | |
| export * from '@fullcalendar/common'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment