UNPKG

mobile-react-infinite-calendar

Version:

A mobile-optimized infinite scroll calendar component for React

72 lines (71 loc) 1.68 kB
/** * 캘린더 상태 관리를 위한 Reducer */ import { Holiday } from '../types'; export interface CalendarState { autoHolidays: Holiday[]; holidayLoading: boolean; displayMonth: Date; activeMonth: Date; infiniteMonths: Date[]; availableHeight: number | null; isCurrentMonthVisible: boolean; isInitialScrollSet: boolean; showDateSelector: boolean; selectedYear: number; selectedMonth: number; showYearDropdown: boolean; showMonthDropdown: boolean; } export type CalendarAction = { type: 'SET_AUTO_HOLIDAYS'; payload: Holiday[]; } | { type: 'SET_HOLIDAY_LOADING'; payload: boolean; } | { type: 'SET_DISPLAY_MONTH'; payload: Date; } | { type: 'SET_ACTIVE_MONTH'; payload: Date; } | { type: 'SET_INFINITE_MONTHS'; payload: Date[]; } | { type: 'ADD_PREV_MONTH'; } | { type: 'ADD_NEXT_MONTH'; } | { type: 'SET_AVAILABLE_HEIGHT'; payload: number | null; } | { type: 'SET_CURRENT_MONTH_VISIBLE'; payload: boolean; } | { type: 'SET_INITIAL_SCROLL'; payload: boolean; } | { type: 'OPEN_DATE_SELECTOR'; } | { type: 'CLOSE_DATE_SELECTOR'; } | { type: 'SET_SELECTED_YEAR'; payload: number; } | { type: 'SET_SELECTED_MONTH'; payload: number; } | { type: 'TOGGLE_YEAR_DROPDOWN'; } | { type: 'TOGGLE_MONTH_DROPDOWN'; } | { type: 'CONFIRM_DATE_SELECTION'; } | { type: 'GO_TO_TODAY'; } | { type: 'RESET_TO_DATE'; payload: Date; }; export declare const createInitialState: (initialDate?: Date) => CalendarState; export declare function calendarReducer(state: CalendarState, action: CalendarAction): CalendarState;