Skip to content

Conversation

@dhruvdutt
Copy link
Contributor

No description provided.

@kamleshchandnani
Copy link
Contributor

kamleshchandnani commented May 3, 2019

Deploy preview for leaf-ui ready!

Built with commit 05075eb

https://deploy-preview-196--leaf-ui.netlify.com

}),
format: PropTypes.string,
minRange: PropTypes.number,
maxRange: PropTypes.number,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about having

range: {
	min: 1,
	max: Infinity,
}

@kamleshchandnani
Copy link
Contributor

I could see component remounts on this preview. You can check that in the network tab the fonts are being downloaded again and again on every range selection and it triggers a flash as well when you look at the component. Just ensure that it's not netlify which is screwing this up. The stories are broken for simple, beforeDays, weekdays

this.datePickerHasFocus = false;
this.timeout = {};
this.range = {
min: this.props.range.min >= 0 ? this.props.range.min : 1,
Copy link
Contributor

@kamleshchandnani kamleshchandnani May 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather have this in render than here since we should not block props reflow. You can definitely argue that this prop will not change throughout the lifecycle of this component but you can't enforce that on your users/consumers I can have

<DateRangePickerInput
range={{ min: someValueFromState, max: someValueFromState}}
/>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

makeSelectionRange = (selectionRange) => ({
    min: selectionRange.hasOwnProperty('min') ? selectionRange.min : 1,
    max: selectionRange.hasOwnProperty('max') ? selectionRange.max : Infinity,
  })

and from render you can call this
const selectionRange = makeSelectionRange(this.props.selectionRange)

@kamleshchandnani kamleshchandnani dismissed their stale review May 4, 2019 15:10

feat(DateRangePickerInput/web): max range (#196)

@kamleshchandnani kamleshchandnani self-requested a review May 4, 2019 15:11
from: PropTypes.bool,
to: PropTypes.bool,
}),
range: PropTypes.shape({
Copy link
Contributor

@kamleshchandnani kamleshchandnani May 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this prop can be renamed to selectionRange because it's too confusing otherwise?

required: {
from: false,
to: false,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't ignore defaultProps. That's the reason other stories are breaking since they are getting range as undefined in the constructor that's where defaultProps helps you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants