All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m54s
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
import { Button } from "../ui/button";
|
|
import DatePickerWithRange from "./date-picker";
|
|
import type { DateTime } from "luxon";
|
|
|
|
export default function WeekNavigation({
|
|
startDate,
|
|
setStartDate,
|
|
}: {
|
|
startDate: DateTime;
|
|
setStartDate: (date: DateTime) => void;
|
|
}) {
|
|
const handlePreviousWeek = () => {
|
|
const previousWeek = startDate.minus({ weeks: 1 });
|
|
setStartDate(previousWeek);
|
|
};
|
|
|
|
const handleNextWeek = () => {
|
|
const nextWeek = startDate.plus({ weeks: 1 });
|
|
setStartDate(nextWeek);
|
|
};
|
|
|
|
return (
|
|
<div className="mb-0">
|
|
<div className="flex flex-row items-center justify-between gap-2">
|
|
<Button variant="outline" size="sm" onClick={handlePreviousWeek}>
|
|
<ChevronLeft className="h-10 w-10" />
|
|
</Button>
|
|
<div className="flex-1">
|
|
<DatePickerWithRange
|
|
startDate={startDate}
|
|
setStartDate={setStartDate}
|
|
/>
|
|
</div>
|
|
<Button variant="outline" size="sm" onClick={handleNextWeek}>
|
|
<ChevronRight className="h-10 w-10" />
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|