@codecademy/gamut
68.2.268.2.3-alpha.93a7da.0
dist/DatePicker/DatePickerCalendar/Calendar/CalendarNavLastMonth.js+
dist/DatePicker/DatePickerCalendar/Calendar/CalendarNavLastMonth.jsNew file+33
Index: package/dist/DatePicker/DatePickerCalendar/Calendar/CalendarNavLastMonth.js
===================================================================
--- package/dist/DatePicker/DatePickerCalendar/Calendar/CalendarNavLastMonth.js
+++ package/dist/DatePicker/DatePickerCalendar/Calendar/CalendarNavLastMonth.js
@@ -0,0 +1,33 @@
+import { MiniChevronLeftIcon } from '@codecademy/gamut-icons';
+import * as React from 'react';
+import { IconButton } from '../../../Button';
+import { useResolvedLocale } from '../../utils/locale';
+import { getRelativeMonthLabels } from './utils/format';
+import { jsx as _jsx } from "react/jsx-runtime";
+export const CalendarNavLastMonth = ({
+ displayDate,
+ onDisplayDateChange,
+ onLastMonthClick,
+ locale
+}) => {
+ const resolvedLocale = useResolvedLocale(locale);
+ const {
+ lastMonth
+ } = getRelativeMonthLabels(resolvedLocale);
+ const buttonRef = React.useRef(null);
+ const handleLastMonth = () => {
+ const lastMonth = new Date(displayDate.getFullYear(), displayDate.getMonth() - 1, 1);
+ onDisplayDateChange?.(lastMonth);
+ onLastMonthClick?.();
+ buttonRef.current?.blur();
+ };
+ return /*#__PURE__*/_jsx(IconButton, {
+ alignSelf: "flex-start",
+ "aria-label": lastMonth,
+ icon: MiniChevronLeftIcon,
+ ref: buttonRef,
+ size: "small",
+ tip: lastMonth,
+ onClick: handleLastMonth
+ });
+};
\ No newline at end of file