-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
add hovered-start-blocked-minimun-nights and hovered-start-first-possible-end modifiers #1547
add hovered-start-blocked-minimun-nights and hovered-start-first-possible-end modifiers #1547
Conversation
@TaeKimJR @noratarano @monokrome Can you also please take a look? Thanks! |
7fb6fb3
to
49c6582
Compare
it('does not call addModifierToRange with `hovered-start-blocked-minimum-nights` if the hovered date is blocked', () => { | ||
const addModifierToRangeSpy = sinon.spy(DayPickerRangeController.prototype, 'addModifierToRange'); | ||
const getMinNightsForHoverDateStub = sinon.stub().returns(2); | ||
const wrapper = shallow(<DayPickerRangeController |
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.
a (
should end the line here
{...props} | ||
getMinNightsForHoverDate={getMinNightsForHoverDateStub} | ||
isDayBlocked={day => isSameDay(day, today)} | ||
/>); |
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.
and )
should begin one
@@ -0,0 +1 @@ | |||
{"value":{"success":true,"data":{"next":{"version":"5.0.0-rc.6","info":{"plain":"### Bug Fixes\n\n* Addon-actions: FIX performance by upgrading to telejson 2.1 ([#5751](https://github.com/storybooks/storybook/pull/5751))\n* UI: FIX bad treeview mockdata ([#5741](https://github.com/storybooks/storybook/pull/5741))\n* UI: About page styling fixes ([#5732](https://github.com/storybooks/storybook/pull/5732))\n* UI: Restore the toolbar eject button ([#5737](https://github.com/storybooks/storybook/pull/5737))"}},"latest":{"version":"4.1.13","info":{"plain":"### Documentation\n\n* Fix unkind addon-ondevice-knobs readme. ([#5629](https://github.com/storybooks/storybook/pull/5629))\n\n### Maintenance\n\n* Cleanup CLI version notice ([#5699](https://github.com/storybooks/storybook/pull/5699))\n* Use static versions.json file instead of hacking one in ([#5675](https://github.com/storybooks/storybook/pull/5675))"}}},"time":1551291194564},"type":"Object"} |
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.
revert?
53dd10f
to
3a5bfe6
Compare
…rst-possible-end modifiers
…en it is a touch device
3a5bfe6
to
99135fe
Compare
This PR adds two new modifiers,
hovered-start-blocked-minimum-nights
andhovered-start-first-possible-end
, which, whenfocusedInput
isSTART_DATE
, keep track of the days blocked by the minimum nights requirement and the first possible end date for the hovered day. This makes the user aware of the minimum nights requirement before even clicking on the day.I added the
getMinNightsForHoverDate
function to the props because in my case it is possible for the min nights requirement for the hovered date to be different from the one passed in as theminimumNights
prop.I originally intended to make a more generic modifier similar to
highlighted-calendar
where the user could supply the function used to determine if the day should have the modifier applied to it, but it was too computationally heavy to call this function on every visible day every time the hover day changed.Gif of change:
Reviewers:
@majapw @ljharb