Skip to content

Commit 34dec59

Browse files
authored
fix(DateRangePicker): disable year pagination (#353)
1 parent c1e5a86 commit 34dec59

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/input-elements/DateRangePicker/Calendar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ const CalendarHeader = ({
9595
>
9696
<button
9797
type="button"
98-
hidden={!enableYearPagination}
9998
className={twMerge(
10099
makeDateRangePickerClassName("calendarHeaderPrevYearButton"),
101100
"inline-flex focus:outline-none focus:ring-2",
101+
!enableYearPagination && "hidden",
102102
getColorClassNames(DEFAULT_COLOR, colorPalette.canvasBackground).hoverBgColor,
103103
getColorClassNames(DEFAULT_COLOR, colorPalette.ring).borderColor,
104104
getColorClassNames("blue", colorPalette.lightRing).focusRingColor,
@@ -198,10 +198,10 @@ const CalendarHeader = ({
198198
</button>
199199
<button
200200
type="button"
201-
hidden={!enableYearPagination}
202201
className={twMerge(
203202
makeDateRangePickerClassName("calendarHeaderNextYearButton"),
204203
"inline-flex focus:outline-none focus:ring-2",
204+
!enableYearPagination && "hidden",
205205
getColorClassNames(DEFAULT_COLOR, colorPalette.canvasBackground).hoverBgColor,
206206
getColorClassNames(DEFAULT_COLOR, colorPalette.ring).borderColor,
207207
getColorClassNames("blue", colorPalette.lightRing).focusRingColor,

src/stories/input-elements/DateRangePicker.stories.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ UncontrolledWithDropdownOptionsWithEndDate.args = {
137137
],
138138
};
139139

140+
export const UncontrolledWithYearPaginationEnabled = UncontrolledTemplate.bind({});
141+
UncontrolledWithYearPaginationEnabled.args = {
142+
defaultValue: [new Date(2022, 10, 1), new Date(), "tdy"],
143+
enableYearPagination: true,
144+
};
145+
140146
export const ControlledDefault = ControlledTemplate.bind({});
141147

142148
export const ControlledWithDefaultDateRange = ControlledTemplate.bind({});

0 commit comments

Comments
 (0)