Skip to content
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

Merged
merged 3 commits into from
Feb 25, 2018

Conversation

aivins
Copy link
Contributor

@aivins aivins commented Feb 19, 2018

This PR permits explicit passing in of the disabled prop to a PaginationItem.

@welcome
Copy link

welcome bot commented Feb 19, 2018

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to run the doc site locally and try a few pages, ensuring everything is in good working order.
  • Include tests when adding/changing behavior.

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-io
Copy link

codecov-io commented Feb 19, 2018

Codecov Report

Merging #2537 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2537      +/-   ##
==========================================
+ Coverage   99.74%   99.74%   +<.01%     
==========================================
  Files         160      160              
  Lines        2744     2745       +1     
==========================================
+ Hits         2737     2738       +1     
  Misses          7        7
Impacted Files Coverage Δ
src/addons/Pagination/PaginationItem.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1a2db8...2703194. Read the comment docs.

@@ -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'
Copy link
Member

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?

Copy link
Member

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

@layershifter layershifter force-pushed the disabled-pagination-items branch from 16220ab to 3d614b4 Compare February 25, 2018 13:51
@layershifter layershifter force-pushed the disabled-pagination-items branch from 3d614b4 to 2703194 Compare February 25, 2018 13:57
Copy link
Member

@layershifter layershifter left a 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,
Copy link
Member

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 👍

Copy link
Member

Choose a reason for hiding this comment

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

You're awesome ❤️

@layershifter layershifter changed the title fix(PaginationItem): support disabled prop fix(Pagination): allow to override props Feb 25, 2018
@layershifter layershifter changed the title fix(Pagination): allow to override props fix(Pagination): allow to override props in PaginationItem Feb 25, 2018
@levithomason levithomason merged commit 8490dd0 into Semantic-Org:master Feb 25, 2018
@welcome
Copy link

welcome bot commented Feb 25, 2018

Congrats on merging your first pull request! 🎉🎉🎉

robot victory dance

@levithomason
Copy link
Member

Thanks!

@levithomason
Copy link
Member

Released in [email protected].

Brantron pushed a commit to Brantron/Semantic-UI-React that referenced this pull request Mar 14, 2018
…Org#2537)

* fix(PaginationItem): support disabled prop

* fix(Pagination): rework usage of MenuItem factory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants