Calender Navigation #13
@@ -11,18 +11,20 @@ type days =
|
|||||||
| "Friday"
|
| "Friday"
|
||||||
| "Saturday";
|
| "Saturday";
|
||||||
|
|
||||||
|
interface DaysOfWeek {
|
||||||
|
startOfWeek: {
|
||||||
|
Sunday: days[];
|
||||||
|
Monday: days[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
interface CalenderContextState {
|
interface CalenderContextState {
|
||||||
today: Date;
|
today: Date;
|
||||||
selectedMonth: Date;
|
selectedMonth: Date;
|
||||||
endOfCurrMonth: Date;
|
|
||||||
lastDay: number;
|
|
||||||
daysOfMonth: [number] | [null];
|
daysOfMonth: [number] | [null];
|
||||||
daysOfWeek: {
|
daysOfWeek: DaysOfWeek;
|
||||||
startOfWeek: {
|
prevMonth: () => void;
|
||||||
Sunday: [days];
|
nextMonth: () => void;
|
||||||
Monday: [days];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const CalenderContext = createContext({} as CalenderContextState);
|
const CalenderContext = createContext({} as CalenderContextState);
|
||||||
@@ -77,7 +79,7 @@ const CalenderContextProvider = ({
|
|||||||
}, [selectedMonth]);
|
}, [selectedMonth]);
|
||||||
|
|
||||||
// Calender Layout
|
// Calender Layout
|
||||||
const daysOfWeek = {
|
const daysOfWeek: DaysOfWeek = {
|
||||||
startOfWeek: {
|
startOfWeek: {
|
||||||
Sunday: [
|
Sunday: [
|
||||||
"Sunday",
|
"Sunday",
|
||||||
@@ -125,6 +127,7 @@ const CalenderContextProvider = ({
|
|||||||
daysOfMonth,
|
daysOfMonth,
|
||||||
daysOfWeek,
|
daysOfWeek,
|
||||||
prevMonth,
|
prevMonth,
|
||||||
|
nextMonth,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user