-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(Pagination): allow to override props in PaginationItem #2537
fix(Pagination): allow to override props in PaginationItem #2537
Conversation
💖 Thanks for opening this pull request! 💖 Here is a list of things that will help get it across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Codecov Report
@@ Coverage Diff @@
## master #2537 +/- ##
==========================================
+ Coverage 99.74% 99.74% +<.01%
==========================================
Files 160 160
Lines 2744 2745 +1
==========================================
+ Hits 2737 2738 +1
Misses 7 7
Continue to review full report at Codecov.
|
@@ -66,7 +66,7 @@ class PaginationItem extends Component { | |||
|
|||
render() { | |||
const { active, ariaLabel, type, ...rest } = this.props | |||
const disabled = type === 'ellipsisItem' | |||
const disabled = rest.disabled || type === 'ellipsisItem' |
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.
This sort of makes me wonder why rest
props aren't spread after all other props below, see lines 72-79. Usually, the user's props should always "win".
@layershifter is there a reason for this or what is it an oversight? Also, shouldn't the props passed to the MenuItem
factory be passed as { defaultProps: { ... } }
so that they don't override the users rest
props?
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.
Yep, it's my miss. I will check this PR on this weekend
…React into disabled-pagination-items
16220ab
to
3d614b4
Compare
3d614b4
to
2703194
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.
@levithomason I've pushed
onKeyDown: this.handleKeyDown, | ||
tabIndex: disabled ? -1 : 0, | ||
}, | ||
overrideProps: this.handleOverrides, |
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.
@levithomason I've pushed some changes and added some new tests, ready for your review 👍
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.
You're awesome ❤️
Thanks! |
Released in |
…Org#2537) * fix(PaginationItem): support disabled prop * fix(Pagination): rework usage of MenuItem factory
This PR permits explicit passing in of the disabled prop to a PaginationItem.