-
Notifications
You must be signed in to change notification settings - Fork 31
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
refactor(DatePicker): Break up, extract handlers, consolidate state #3959
Conversation
✅ Deploy Preview for storybook-navy-digital-mod-uk ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
099afaa
to
d5428c0
Compare
d5428c0
to
77b9691
Compare
77b9691
to
2b1f53a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks okay generally. Would've been useful to split this into multiple commits though 😄
(Main negative I can see is probably that it's added a fair bit to the line count...)
packages/react-component-library/src/components/DatePicker/useDatePickerContext.tsx
Outdated
Show resolved
Hide resolved
packages/react-component-library/src/components/DatePicker/Input.tsx
Outdated
Show resolved
Hide resolved
packages/react-component-library/src/components/DatePicker/FloatingCalendar.tsx
Outdated
Show resolved
Hide resolved
8e5cd4d
to
5f0ed87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I think it looks good and also gets me thinking about custom hooks - whether 1-2 more could be introduced or whether the existing ones need rework/adding to, but this is far enough for now.
5f0ed87
to
349a5b5
Compare
Quality Gate passedIssues Measures |
Overview
Refactor DatePicker.
This is a boy scout step change, I'm not aiming for perfection (other things to move on to).
I'm also not fully convinced this is better. I feel like i've added more code and indirection.
Reason
#3955 (comment)
Work carried out
DatePicker
intoInput
andFloatingCalendar
sub componentscalendarTableVariant
,isOpen
)Developer notes
I'm using context to expose the reducer, which is naughty with mutable state but performance impact is limited: