This repository was archived by the owner on May 18, 2024. It is now read-only.
(fix): ui-toolkit - Calendar functionality and styling #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
active,disabledandhoverstates.2minandmaxvaluesdisabledstate in case of hoveronMonthClick | onDateClickvalidationMonthCalendartoDateCalendarhighlightCurrentDateprop to show the current datedisabledstate greyed-out in both calendarstringtoDATE | MONTHwith fallback toDATEkeyprop in several places to fix un-necessary re-renders.These fixes were made specifically to address issues with calendar component across
web_appslikemax | mindate value and shows pointer even ondisabledstateAfter:
Notes:
max<min, Could have thrown an error if__DEV__?MonthCalendarandDateCalendarare now same, however there is no breaking change as props have been extended to additional functionality.highlightCurrentDateprop istrueby default and will highlight the current value, Could be false?utilsoutside ascompareDatefunction was needed in bothactivestate was conditionally improperly https://github.com/Groww/webster/blob/37221681d7bb7e9552a5e5d52d27137868caa29a/packages/ui-toolkit/src/components/molecules/Calendar/DateCalendar/index.tsx#L146 this will never work until a re-render is triggered, currentlyonDateClickdoesn't update any state so no re-render will trigger andactivestates won't be markedhttps://github.com/Groww/webster/blob/37221681d7bb7e9552a5e5d52d27137868caa29a/packages/ui-toolkit/src/components/molecules/Calendar/DateCalendar/index.tsx#L217-L233
To solve this
selectedDate: Date | null;was added in React State which is used in calendar dates and will trigger a re-render to mark the new selection date.highlightCurrentDatean already existing color--green300has been set and for selected date--green500What packages have been affected by this PR?
Types of changes
What types of changes does your code introduce to this project?
Put an
xin the boxes that applyBugfix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Package version increase in any of the packages?
0.4.6Checklist before merging
Put an
xin the boxes that applyThese changes have been thoroughly tested.
Changes need to be immediately published on npm.