Conversation
|
Deploy preview for leaf-ui ready! Built with commit 05075eb |
| }), | ||
| format: PropTypes.string, | ||
| minRange: PropTypes.number, | ||
| maxRange: PropTypes.number, |
There was a problem hiding this comment.
how about having
range: {
min: 1,
max: Infinity,
}
|
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 |
| this.datePickerHasFocus = false; | ||
| this.timeout = {}; | ||
| this.range = { | ||
| min: this.props.range.min >= 0 ? this.props.range.min : 1, |
There was a problem hiding this comment.
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}}
/>
There was a problem hiding this comment.
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)
feat(DateRangePickerInput/web): max range (#196)
| from: PropTypes.bool, | ||
| to: PropTypes.bool, | ||
| }), | ||
| range: PropTypes.shape({ |
There was a problem hiding this comment.
also this prop can be renamed to selectionRange because it's too confusing otherwise?
| @@ -426,7 +434,6 @@ DateRangePickerInput.defaultProps = { | |||
| from: false, | |||
| to: false, | |||
| }, | |||
There was a problem hiding this comment.
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
No description provided.