import { isPrevMonthAllowed as checkPrevMonthAllowed, isNextMonthAllowed as checkNextMonthAllowed, } from 'shared-utils/calendar/date-validation' import { PktIcon } from '../icon/Icon' import type { ICalendarNavProps } from './types' export const CalendarNav = ({ componentId, strings, year, month, earliest, latest, withcontrols, prevMonth, nextMonth, changeMonth, }: ICalendarNavProps) => { const renderMonthNavButton = (direction: 'prev' | 'next') => { const isPrev = direction === 'prev' const isAllowed = isPrev ? checkPrevMonthAllowed(year, month, earliest) : checkNextMonthAllowed(year, month, latest) const label = isPrev ? strings.prevMonth : strings.nextMonth const iconName = isPrev ? 'chevron-thin-left' : 'chevron-thin-right' const btnClassName = isPrev ? 'pkt-calendar__prev-month' : 'pkt-calendar__next-month' const onClick = isPrev ? prevMonth : nextMonth return (