- {/* Month nav */}
+ {/* Header: arrows step the current view, the label climbs to the next one up */}
-
- {/* Weekday headers */}
-
- {['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'].map((d, i) => (
-
{d}
- ))}
-
-
- {/* Day grid */}
-
- {cells.map((day, i) => {
- if (day === null) return
- const dateStr = `${viewMonth.year}-${pad(viewMonth.month + 1)}-${pad(day)}`
- const isSelected = dateStr === value
- const isTrip = tripDates?.has(dateStr)
- const isToday = dateStr === localIsoDate()
-
- return (
-
{ onChange(dateStr); setOpen(false) }}
- className={`w-9 h-9 rounded-lg text-[12px] font-medium flex items-center justify-center relative transition-colors ${
- isSelected
- ? 'bg-zinc-900 dark:bg-white text-white dark:text-zinc-900'
- : isToday
- ? 'text-zinc-900 dark:text-white font-bold'
- : 'text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700'
- }`}
- >
- {day}
- {isTrip && !isSelected && (
-
- )}
+ {view === 'months' && (
+
+ {monthNames.map((name, i) => (
+ selectMonth(i)} className={gridCell(i === viewMonth.month)}>
+ {name}
- )
- })}
-
+ ))}
+
+ )}
+
+ {view === 'years' && (
+
+ {years.map(y => (
+ selectYear(y)} className={gridCell(y === viewMonth.year)}>
+ {y}
+
+ ))}
+
+ )}
+
+ {view === 'days' && (
+ <>
+ {/* Weekday headers */}
+
+ {['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'].map((d, i) => (
+
{d}
+ ))}
+
+
+ {/* Day grid */}
+
+ {cells.map((day, i) => {
+ if (day === null) return
+ const dateStr = `${viewMonth.year}-${pad(viewMonth.month + 1)}-${pad(day)}`
+ const isSelected = dateStr === value
+ const isTrip = tripDates?.has(dateStr)
+ const isToday = dateStr === localIsoDate()
+
+ return (
+
{ onChange(dateStr); setOpen(false) }}
+ className={`w-9 h-9 rounded-lg text-[12px] font-medium flex items-center justify-center relative transition-colors ${
+ isSelected
+ ? 'bg-zinc-900 dark:bg-white text-white dark:text-zinc-900'
+ : isToday
+ ? 'text-zinc-900 dark:text-white font-bold'
+ : 'text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700'
+ }`}
+ >
+ {day}
+ {isTrip && !isSelected && (
+
+ )}
+
+ )
+ })}
+
+ >
+ )}