mobile-react-infinite-calendar
Version:
A mobile-optimized infinite scroll calendar component for React
55 lines (54 loc) • 1.72 kB
TypeScript
/**
* 리팩토링된 InfiniteCalendar 컴포넌트
* - 비즈니스 로직과 UI 완전 분리
* - 복잡한 로직을 커스텀 훅으로 추출
* - 단일 책임 원칙 적용
* - 성능 최적화 및 메모리 리크 방지
*/
import type { CalendarEvent, Holiday, LocaleCode, CalendarOptions } from '../types';
interface InfiniteCalendarProps {
events?: CalendarEvent[];
holidays?: Holiday[];
dynamicEvents?: (startDate: string | Date, endDate: string | Date) => Promise<any[]>;
dynamicEventMapping?: {
id?: string;
title?: string;
date?: string;
startTime?: string;
endTime?: string;
color?: string;
description?: string;
};
dynamicEventTransform?: (apiData: any) => CalendarEvent;
onDynamicEventLoad?: (startDate: Date, endDate: Date, events: CalendarEvent[]) => void;
onDayAction?: (date: Date, dayInfo?: {
events: CalendarEvent[];
holidays: Holiday[];
}) => void;
locale?: LocaleCode | string;
holidayServiceKey?: string;
options?: CalendarOptions;
showTodayButton?: boolean;
showDatePicker?: boolean;
height?: number | 'auto';
initialDate?: Date;
}
/**
* 무한 스크롤 캘린더 컴포넌트
*
* @example
* ```tsx
* <InfiniteCalendar
* events={events}
* dynamicEvents={async (startDate, endDate) => await fetchEvents(startDate, endDate)}
* onDayAction={(date, dayInfo) => handleDayClick(date, dayInfo)}
* options={{
* debug: true,
* height: 'auto',
* autoHeight: { bottomOffset: 20 }
* }}
* />
* ```
*/
declare const InfiniteCalendar: import("react").NamedExoticComponent<InfiniteCalendarProps>;
export { InfiniteCalendar };