This repository was archived by the owner on May 18, 2024. It is now read-only.
(fix): ui-toolkit - Calendar functionality and styling #326
Open
rohangupta-groww wants to merge 5 commits into
Open
(fix): ui-toolkit - Calendar functionality and styling #326rohangupta-groww wants to merge 5 commits into
rohangupta-groww wants to merge 5 commits into
Conversation
Amit-Groww
approved these changes
Sep 28, 2023
Amit-Groww
left a comment
Contributor
There was a problem hiding this comment.
discussed few minor changes
ayush-mani-tripathi
approved these changes
Sep 28, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.