Skip to content

Commit

Permalink
chore: remove unnecessary labelOptions from labelNext, labelPrevious (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl authored Sep 8, 2024
1 parent 720c267 commit 27aa413
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/DayPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export function DayPicker(props: DayPickerProps) {
className={classNames[UI.ButtonPrevious]}
tabIndex={previousMonth ? undefined : -1}
disabled={previousMonth ? undefined : true}
aria-label={labelPrevious(previousMonth, labelOptions)}
aria-label={labelPrevious(previousMonth)}
onClick={handlePreviousClick}
>
<components.Chevron
Expand All @@ -298,7 +298,7 @@ export function DayPicker(props: DayPickerProps) {
className={classNames[UI.ButtonNext]}
tabIndex={nextMonth ? undefined : -1}
disabled={nextMonth ? undefined : true}
aria-label={labelNext(nextMonth, labelOptions)}
aria-label={labelNext(nextMonth)}
onClick={handleNextClick}
>
<components.Chevron
Expand Down
2 changes: 1 addition & 1 deletion src/labels/labelNext.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { labelNext } from "./labelNext";

test("should return the label", () => {
expect(labelNext(new Date(), {})).toEqual("Go to the Next Month");
expect(labelNext(new Date())).toEqual("Go to the Next Month");
});
7 changes: 2 additions & 5 deletions src/labels/labelNext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { LabelOptions } from "../lib/dateLib.js";

/**
* The ARIA label for next month button.
*
Expand All @@ -8,9 +6,8 @@ import type { LabelOptions } from "../lib/dateLib.js";
* @see https://daypicker.dev/docs/translation#aria-labels
*/
export function labelNext(
/** Undefined where there's no next month no navigate to. */
month: Date | undefined,
options?: LabelOptions
/** `undefined` where there's no next month to navigate to. */
month: Date | undefined
) {
return "Go to the Next Month";
}
2 changes: 1 addition & 1 deletion src/labels/labelPrevious.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { labelPrevious } from "./labelPrevious";

test("should return the label", () => {
expect(labelPrevious(new Date(), {})).toEqual("Go to the Previous Month");
expect(labelPrevious(new Date())).toEqual("Go to the Previous Month");
});
7 changes: 2 additions & 5 deletions src/labels/labelPrevious.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { LabelOptions } from "../lib/dateLib.js";

/**
* The ARIA label for previous month button.
*
Expand All @@ -8,9 +6,8 @@ import type { LabelOptions } from "../lib/dateLib.js";
* @see https://daypicker.dev/docs/translation#aria-labels
*/
export function labelPrevious(
/** Undefined where there's no previous month no navigate to. */
month: Date | undefined,
options?: LabelOptions
/** Undefined where there's no previous month to navigate to. */
month: Date | undefined
) {
return "Go to the Previous Month";
}
2 changes: 1 addition & 1 deletion src/types/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export type Labels = {
labelNext: typeof labelNext;
/** The label for the "previous month" button. */
labelPrevious: typeof labelPrevious;
/** The label for the day button.. */
/** The label for the day button. */
labelDayButton: typeof labelDayButton;
/** @deprecated Use {@link labelDayButton} instead. */
labelDay: typeof labelDayButton;
Expand Down

0 comments on commit 27aa413

Please sign in to comment.