Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unnecessary labelOptions from labelNext, labelPrevious #2434

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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