-
-
Notifications
You must be signed in to change notification settings - Fork 55
Add clearOnSameDateClick prop (Issue #24) #25
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
Conversation
This pull request is automatically deployed with Now. |
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
=========================================
- Coverage 9.75% 9.68% -0.07%
=========================================
Files 13 13
Lines 287 289 +2
Branches 58 59 +1
=========================================
Hits 28 28
- Misses 206 207 +1
- Partials 53 54 +1
Continue to review full report at Codecov.
|
@jalavosus, great work! Thanks for adding this feature. Can you rebase your branch and solve the conflict so I can merge it? And feel free to add yourself to the contributors table by running the |
This prop, if `false`, will prevent the component's state from resetting if the same date is clicked in succession. So as to not break previous or expected default behavior, the default value of this prop is `true`.
being equal to `false`.
* Add clearOnSameDateSelect prop to basic datepicker. This prop, if `false`, will prevent the component's state from resetting if the same date is clicked in succession. So as to not break previous or expected default behavior, the default value of this prop is `true`. * Add storybook entry for the clearOnSameDateClick prop being equal to `false`. * Updated README.md to reflect clearOnSameDateClick prop.
* Add clearOnSameDateSelect prop to basic datepicker. This prop, if `false`, will prevent the component's state from resetting if the same date is clicked in succession. So as to not break previous or expected default behavior, the default value of this prop is `true`. * Add storybook entry for the clearOnSameDateClick prop being equal to `false`. * Updated README.md to reflect clearOnSameDateClick prop.
The features in your PRs are now published in the version 1.9.0. 🎉 Thanks once again, @jalavosus! |
What kind of change does this PR introduce?
This PR is a first draft implementation of my proposal in #24.
It introduces a new prop,
clearOnSameDateClick
(bool
), which controls whether or not the state of the datepicker component gets reset if the same date is clicked in succession.Ex. I click the "Today" button, and then click it again.
With the default behavior (prop=
true
), the entire datepicker would reset (including clearing the previous selection).If
clearOnSameDateClick
is set tofalse
, the datepicker doesn't reset, and the previous selection is maintained with each successive click of the same date.Checklist:
yarn test
passes)Closes #24.