-
Notifications
You must be signed in to change notification settings - Fork 26
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
Redo DateInput using downshift #281
Conversation
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.
This seems really clean. 👍
df503d4
to
5d790e5
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.
Looks really clean to me, and I tested the UI and it works really nice as well. Good job.
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import requiredIf from 'react-required-if'; | ||
import Downshift from 'downshift'; |
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.
Note that we're not importing moment
into this component at all. All usage of moment
is moved to the utils. This allows to use the date-input
(and the other ones) with any date-library (like date-fns
).
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.
Looks very good! Good job!
} | ||
|
||
.year > * { | ||
margin: 0 0 0 4px; |
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 am such a party pooper! Why not 6px?
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.
Both 4px and 6px are part of our design system. Why would you prefer 6px?
|
||
.menu { | ||
composes: menuBase; | ||
padding-bottom: 10px; |
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.
Is this a sum of 4 and 6 on the .container
? Should we have variables and a calc
here?
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.
It's not the sum of anything to my knowledge. We don't need to have a design token for everything, it's okay if edge-cases use their own values. A date-calendar is a one-off component imho. There is no token for a spacing of 10 either, so I hardcoded it.
fa849a1
to
9ebae36
Compare
3ac9eb3
to
2932680
Compare
This is the new
DateInput
based ondownshift
.I will add follow-up PRs to replace
DateTimeInput
and to addDateRangeInput
based on this one.Breaking Change Previously
onChange
would be called with the value directly. Now it gets called with an event containing the value. This was done to be in line with how the other inputs work.