import { cn } from "@/lib/cn";
import {
getWeekDays,
getWeekdayLetter,
getDayOfMonth,
isSameDayAs,
isToday,
getPreviousWeek,
getNextWeek,
} from "@/utils/dates";
import { ChevronLeftIcon, ChevronRightIcon } from "@/components/ui";
interface WeekStripProps {
selectedDate: Date;
onDateSelect: (date: Date) => void;
}
export function WeekStrip({ selectedDate, onDateSelect }: WeekStripProps) {
const weekDays = getWeekDays(selectedDate);
const handlePreviousWeek = () => {
onDateSelect(getPreviousWeek(selectedDate));
};
const handleNextWeek = () => {
onDateSelect(getNextWeek(selectedDate));
};
const handleTodayClick = () => {
onDateSelect(new Date());
};
const showTodayButton = !isToday(selectedDate);
return (
{weekDays.map((date, index) => {
const isSelected = isSameDayAs(date, selectedDate);
const isTodayDate = isToday(date);
return (
);
})}
{showTodayButton && (
)}
);
}