import LeftArrowIcon from '@/assets/icons/left-arrow.svg' import RightArrowIcon from '@/assets/icons/right-arrow.svg' import { useEffect, useState } from 'react' import { getCalendarDates, getL10Weekday } from '../utils' export default () => { const [currentMonth, setCurrentMonth] = useState(new Date().getMonth()) const [currentYear, setCurrentYear] = useState(new Date().getFullYear()) const [selectedDate, setSelectedDate] = useState(new Date()) const [dates, setDates] = useState([]) const l10nDays = getL10Weekday() useEffect(() => { setDates(getCalendarDates(currentMonth, currentYear)) }, [currentMonth, currentYear]) function selectDate(date: Date) { setSelectedDate(date) } function skipToLastMonth() { if (currentMonth === 0) { setCurrentMonth(11) setCurrentYear(currentYear - 1) } else setCurrentMonth(currentMonth - 1) } function skipToNextMonth() { if (currentMonth === 11) { setCurrentMonth(0) setCurrentYear(currentYear + 1) } else setCurrentMonth(currentMonth + 1) } return (
{l10nDays.map(day =>
{day}
)} {dates.map(date => )}
) }