fix(datePicker): hide next button for inactive months on larger screens

This commit is contained in:
hamed
2026-07-23 19:43:02 +03:30
parent cd32f6c8bd
commit 0a2a2bfba3
2 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -119,7 +119,10 @@ function DatePicker({ setDate, clinicUuid = null }) {
selectedDate={selectedDate} selectedDate={selectedDate}
onSelectDay={selectDay} onSelectDay={selectDay}
isDisabled={isDisabled} isDisabled={isDisabled}
showNext={false} // وقتی تقویم ماه بعد در کنار این نمایش داده می‌شود (md و xl) دکمهٔ «بعد»
// این تقویم پنهان می‌ماند تا دوتا نشود؛ در موبایل و lg که تنها همین تقویم
// دیده می‌شود، دکمهٔ «بعد» فعال است تا کاربر بتواند به ماه بعد برود.
nextBtnClass="md:invisible lg:visible xl:invisible"
onPrev={() => setBaseMonth(moment(baseMonth).subtract(1, "jMonth"))} onPrev={() => setBaseMonth(moment(baseMonth).subtract(1, "jMonth"))}
onNext={() => setBaseMonth(moment(baseMonth).add(1, "jMonth"))} onNext={() => setBaseMonth(moment(baseMonth).add(1, "jMonth"))}
/> />
+4 -2
View File
@@ -42,6 +42,8 @@ function InlineJalaliMonth({
onNext, onNext,
showPrev = true, showPrev = true,
showNext = true, showNext = true,
prevBtnClass = "",
nextBtnClass = "",
}) { }) {
const days = buildDays(displayDate); const days = buildDays(displayDate);
@@ -51,7 +53,7 @@ function InlineJalaliMonth({
<button <button
type="button" type="button"
onClick={onNext} onClick={onNext}
className={`p-1 text-[#525252] ${showNext ? "" : "invisible"}`} className={`p-1 text-[#525252] ${showNext ? "" : "invisible"} ${nextBtnClass}`}
aria-label="ماه بعد" aria-label="ماه بعد"
> >
@@ -62,7 +64,7 @@ function InlineJalaliMonth({
<button <button
type="button" type="button"
onClick={onPrev} onClick={onPrev}
className={`p-1 text-[#525252] ${showPrev ? "" : "invisible"}`} className={`p-1 text-[#525252] ${showPrev ? "" : "invisible"} ${prevBtnClass}`}
aria-label="ماه قبل" aria-label="ماه قبل"
> >