Skip to content

Instantly share code, notes, and snippets.

@Buom01
Created November 8, 2020 03:20
Show Gist options
  • Select an option

  • Save Buom01/1b814bce259f47afd91dd77716092f32 to your computer and use it in GitHub Desktop.

Select an option

Save Buom01/1b814bce259f47afd91dd77716092f32 to your computer and use it in GitHub Desktop.
@fullcalendar for preact, based on `@fullcalendar/react`
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