Created types file for calender context.
This commit is contained in:
@@ -11,80 +11,6 @@ import {
|
||||
isBefore,
|
||||
compareAsc
|
||||
} from "date-fns";
|
||||
// TODO: import types
|
||||
|
||||
type Days =
|
||||
| "Sunday"
|
||||
| "Monday"
|
||||
| "Tuesday"
|
||||
| "Wednesday"
|
||||
| "Thursday"
|
||||
| "Friday"
|
||||
| "Saturday";
|
||||
|
||||
type DaysOfWeek = Days[];
|
||||
|
||||
interface WeekDays {
|
||||
sunday: DaysOfWeek;
|
||||
monday: DaysOfWeek;
|
||||
}
|
||||
|
||||
interface Sticker {
|
||||
date: Date;
|
||||
sticker: -2 | -1 | 0 | 1 | 2 | null;
|
||||
}
|
||||
|
||||
interface MonthSticker {
|
||||
date: Date;
|
||||
month: Sticker[];
|
||||
}
|
||||
|
||||
interface MonthDay extends Sticker {
|
||||
isOverflow: boolean;
|
||||
overflowDirection: "prev" | "next" | null;
|
||||
}
|
||||
|
||||
interface Month {
|
||||
week1: MonthDay[];
|
||||
week2: MonthDay[];
|
||||
week3: MonthDay[];
|
||||
week4: MonthDay[];
|
||||
week5: MonthDay[];
|
||||
week6: MonthDay[];
|
||||
}
|
||||
|
||||
interface MonthInfo {
|
||||
date: Date;
|
||||
title: string;
|
||||
}
|
||||
|
||||
interface MonthLayout {
|
||||
sunday: {
|
||||
weekdays: DaysOfWeek;
|
||||
month: Month;
|
||||
};
|
||||
monday: {
|
||||
weekdays: DaysOfWeek;
|
||||
month: Month;
|
||||
};
|
||||
}
|
||||
|
||||
interface MonthContext extends MonthInfo {
|
||||
layout: MonthLayout;
|
||||
}
|
||||
|
||||
interface UpdateCalendarProps {
|
||||
year: number;
|
||||
month: number;
|
||||
day: number;
|
||||
}
|
||||
|
||||
interface CalenderContextState {
|
||||
selectedDate: Date;
|
||||
title: string;
|
||||
layout: MonthLayout;
|
||||
updateDate: (input: UpdateCalendarProps) => void;
|
||||
}
|
||||
|
||||
const CalenderContext = createContext({} as CalenderContextState);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user