diff --git a/nextjs/src/app/course/[courseName]/calendar/CalendarMonth.tsx b/nextjs/src/app/course/[courseName]/calendar/CalendarMonth.tsx index 6397f5b..a6feae0 100644 --- a/nextjs/src/app/course/[courseName]/calendar/CalendarMonth.tsx +++ b/nextjs/src/app/course/[courseName]/calendar/CalendarMonth.tsx @@ -3,12 +3,17 @@ import { useState } from "react"; import { CalendarMonthModel } from "./calendarMonthUtils"; import { DayOfWeek } from "@/models/local/localCourse"; import Day from "./Day"; +import "./calendarMonth.css"; export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => { - const [isCollapsed, setIsCollapsed] = useState(false); - + const weekInMilliseconds = 604_800_000; const isInPast = - new Date(month.year, month.month - 1, 1) < new Date(Date.now()); + new Date(month.year, month.month, 1) < + new Date(Date.now() - weekInMilliseconds); + + console.log(month, isInPast); + const [isCollapsed, setIsCollapsed] = useState(isInPast); + const monthName = new Date(month.year, month.month - 1, 1).toLocaleString( "default", { month: "long" } @@ -17,9 +22,16 @@ export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => { // const collapseClass = isInPast ? "collapse _hide" : "collapse _show"; const weekDaysList: DayOfWeek[] = Object.values(DayOfWeek); + console.log(isCollapsed); return ( <> -

+

{/* */}

-
+
{weekDaysList.map((day) => (
diff --git a/nextjs/src/app/course/[courseName]/calendar/calendarMonth.css b/nextjs/src/app/course/[courseName]/calendar/calendarMonth.css new file mode 100644 index 0000000..f358415 --- /dev/null +++ b/nextjs/src/app/course/[courseName]/calendar/calendarMonth.css @@ -0,0 +1,5 @@ +.panel { + max-height: 0; + overflow: hidden; + transition: max-height .5s ease-out; +}