diff --git a/assets/css/src/calendar-strip.css b/assets/css/src/calendar-strip.css index 941bdf8..367f4c3 100644 --- a/assets/css/src/calendar-strip.css +++ b/assets/css/src/calendar-strip.css @@ -22,6 +22,10 @@ width: 100%; } +.calendar-strip__change-week { + display: none; +} + .calendar-strip__days .week, .calendar-strip__days .week > ul { display: contents; @@ -99,7 +103,15 @@ } .calendar-strip__selector { - width: 7rem; + width: 6rem; + } + .calendar-strip__selector span { + margin: auto; + } + + .calendar-strip__change-week { + font-size: 1.5rem; + display: block; } .calendar-strip__calendar-btn { diff --git a/site/snippets/calendar-strip.php b/site/snippets/calendar-strip.php index 675522e..87bf99e 100644 --- a/site/snippets/calendar-strip.php +++ b/site/snippets/calendar-strip.php @@ -79,6 +79,24 @@ } }, + prevWeek() { + if (this.currentWeekIndex === 0) { + this.prevMonth() + this.currentWeekIndex = this.currentWeeks.length - 1 + } else { + this.currentWeekIndex-- + } + }, + + nextWeek() { + if (this.currentWeekIndex === this.currentWeeks.length - 1) { + this.nextMonth() + this.currentWeekIndex = 0 + } else { + this.currentWeekIndex++ + } + }, + nextMonth() { if (this.currentMonthIndex == 12) { this.currentMonthIndex = 1 @@ -103,6 +121,8 @@ + +