-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(datepicker): set up input for date range picker #18159
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
feat(datepicker): set up input for date range picker #18159
Conversation
e3fd3e1
to
ab5ff5a
Compare
Can you send this PR to the |
I'm not sure whether I'd be able to continue working on separately from here on out. The rest of the UI all depends on the date selection model being in place. Maybe now is the time to try and get the selection model merged in? |
Yeah I created that branch at the same commit as this one. You can work on that branch while we try to get this one in master |
Cool, I've changed the PR to point to the |
This is fantastic and looks exactly like what I imagined. Thank you very much! I have two remarks, however:
Maybe I'm overlooking some things though, I haven't even run the code and am just doing my daily quick scan of what's happening 🙂. |
I agree with @ccjmne that we should not force the label to always float, we can just hide the placeholders and dash when the label isn't floating |
ab5ff5a
to
bb0f60a
Compare
@mmalerba all of the feedback should be addressed, aside from the question about what the public API should look like. |
} | ||
} | ||
|
||
// We want the start input to be flush against the separator, no matter how much text it has, but |
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.
Why does the input need to be flush against the separator?
Looking at the gif of your demo, I think it would be better if the separate and end-date input didn't shift as you were typing into the start date. Would it be better to give the input a min-width
(equivalent to e.g. "77/77/7777") so that the end date input doesn't shift as the user is typing?
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.
Because it looks weird if you typed something shorter and then the space around the separator was uneven, e.g.
11/11 - 12/12
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.
What if we right-align the the input?
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.
Which one? The start date input or the date range input in general? I think we'd just the same problem but in a different place.
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 pulled down the PR and tried tweaking a few things locally. I concluded that everything I suggested looks worse than what you ultimately did. I have one more idea, though, which is to hide the end-date input placeholder once you start typing into the start-date input. I tried this out locally and I think it eliminates the appearance of the input getting pushed.
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.
Please leave TODO's for anything that you will handle in a follow-up PR. I feel we've been getting a little lax with the "will handle in a follow-up PR" lately, and I'm worried that things might slip off our radar and never actually get done
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 ended up just doing it now. Can you take one more look @mmalerba? The way it behaves now is that it hides the placeholders when one of these criteria is true:
- The inputs are empty and they have focus.
- The start input is focused and the end input is empty.
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 way I was imagining it, the dash doesn't disappear. @jelbourn should take a look too, since he felt more strongly about the placeholder stuff
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 way I was reading it the dash should disappear, otherwise you'll see it jump to the beginning when you start typing.
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 updated it to keep the separator visible while the start has a value.
bb0f60a
to
cc66e6f
Compare
} | ||
} | ||
|
||
// We want the start input to be flush against the separator, no matter how much text it has, but |
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.
We should also think about the edge cases related to this. e.g. what happens if I skip the start and type in the end input?
If we want to go with Jeremy's suggestion my mental model would be to treat them as a single placeholder, i.e. whenever one of the inputs has text in it both placeholders are hidden
cc66e6f
to
73d4695
Compare
73d4695
to
6445c36
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.
Overall looks good, just a few more minor comments
} | ||
} | ||
|
||
// We want the start input to be flush against the separator, no matter how much text it has, but |
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.
Agreed that we should treat them conceptually as one placeholder. Do you want to do that in this PR or in a follow-up?
6445c36
to
781a535
Compare
Addressed the latest set of feedback. Also fixed that the error state wasn't being calculated correctly. |
a0c6c2e
to
60aa620
Compare
d371811
to
8444614
Compare
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
8444614
to
5780d04
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.
LGTM
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sets up the UI and most of the boilerplate that we'll need for the input that is associated with a date range picker. Doesn't include any interactions with the datepicker itself yet.
Example of how it works:
