-
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 TimeInput #151
Redo TimeInput #151
Conversation
Tests are failing on CI because of something related to |
39d99cd
to
28a8d0c
Compare
Fixed the failing test. Ready for review now :) |
Ok, that wasn't very long until a new requirement surfaced. The input should support a higher precision than currently shown. It should support up to I'll add this before putting the component into review again. |
The |
@dferber90 so much precision, so much wow 😮 👍 |
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.
@dferber90 good job!
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.
Super nice too see so much dependency cruft gone. Thanks a lot! Just left some thoughts.
|
||
export const ClearSection = props => ( | ||
<div | ||
onClick={props.isDisabled ? undefined : props.onClear} |
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've seen null
being passed in that case. I don't mind but was wondering if there is a specific reason.
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'm not aware of a difference and don't have any arguments for either side. I usually use undefined
though.
If the target component was a custom component (not a "native" one like a div
), then passing null
would lead to the default prop not overwriting it if I'm not mistaken. Hence, I usually use undefined
. In this case it does not matter though.
|
||
it('should have focus automatically when isAutofocussed is passed', () => { | ||
const { container } = render(<TimeInput {...baseProps} isAutofocussed />); | ||
expect(container.querySelector('input')).toHaveFocus(); |
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.
❤️
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.
Noticed some things myself
This was approved by @coolmilo as well, so we're good to go! I'm thinking of waiting with the merge though, so that |
hours: Number(hours) + (amPm === 'pm' ? 12 : 0), | ||
minutes: Number(minutes), | ||
seconds: Number(seconds), | ||
milliseconds: Number(milliseconds), |
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.
The parsing of milliseconds is actually wrong. When a user enters 00:00:00.75
we parse 75 milliseconds, but it should be 750. We need to use right-pad to fill up to 3 digits with 0s before parsing the number.
The bug isn't noticeable because we use rightPad before displaying the data in format24hr
, but the parseTime
function itself is broken.
d861157
to
e01cead
Compare
e01cead
to
ed5acdc
Compare
ed5acdc
to
c3b5fbd
Compare
@dferber90 anything else blocking this? Can you give us a status update on how to proceed here? |
See the last comment:
I want to merge this along with #166 so that they can be released at the same time. That's also why the "Awaiting release" label is on this PR. Otherwise consumers would have to do the migration in two steps if we release in between because of a bugfix or something alike. #166 is still missing the implementation of the new designs, but I've started that yesterday. |
Ok thanks for the update 👌 |
2d33e5a
to
66607f0
Compare
289c300
to
f2d5b1b
Compare
Reimagine the component and drop flatpickr.
Workaround for the node Intl API (not react-intl itself). Had to stop using props.intl.formatTime as it was not respecting the passed locale when formatting time.
And change cursor to default one for the input.
Yeah, I know it's bad. The other inputs do not use an outline either right now. There is alternative styling instead. We are discussiong to readd outlines at once eventually.
f2d5b1b
to
d10c881
Compare
Recreates
TimeInput
withoutflatpickr
.Advantages of new
TimeInput
UX:
Code improvements:
isInvalid
tohasError
as we use that for all inputsisAutofocussed
mode
proptimeZone
propvalue
can now always be converted to 24h format usingTimeInput.to24h(value)
name
for easier use with FormikProblems of old
TimeInput
It has the UX limitations that:
it is not possible to enter any value with the keyboardusers can only adjust the time by a specificity of 5 minutesTechnically it had the problems that:
TimeInput
fields can be present at the same time