This repository has been 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
,disabled
andhover
states.2min
andmax
valuesdisabled
state in case of hoveronMonthClick | onDateClick
validationMonthCalendar
toDateCalendar
highlightCurrentDate
prop to show the current datedisabled
state greyed-out in both calendarstring
toDATE | MONTH
with fallback toDATE
key
prop in several places to fix un-necessary re-renders.These fixes were made specifically to address issues with calendar component across
web_apps
likemax | min
date value and shows pointer even ondisabled
stateAfter:
Notes:
max
<min
, Could have thrown an error if__DEV__
?MonthCalendar
andDateCalendar
are now same, however there is no breaking change as props have been extended to additional functionality.highlightCurrentDate
prop istrue
by default and will highlight the current value, Could be false?utils
outside ascompareDate
function was needed in bothactive
state 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, currentlyonDateClick
doesn't update any state so no re-render will trigger andactive
states 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.highlightCurrentDate
an already existing color--green300
has been set and for selected date--green500
What packages have been affected by this PR?
Types of changes
What types of changes does your code introduce to this project?
Put an
x
in 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.6
Checklist before merging
Put an
x
in the boxes that applyThese changes have been thoroughly tested.
Changes need to be immediately published on npm.