Skip to content

feat(Pagination): add Pagination component#108

Merged
eddywashere merged 1 commit intoreactstrap:masterfrom
mking-clari:pagination
Aug 21, 2016
Merged

feat(Pagination): add Pagination component#108
eddywashere merged 1 commit intoreactstrap:masterfrom
mking-clari:pagination

Conversation

@mking-clari
Copy link
Copy Markdown
Contributor

References #77

  • Add Pagination, PaginationItem, PaginationLink
  • Pagination supports sizing
  • PaginationItem supports active and disabled states
  • PaginationLink supports special rendering for next and previous links

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 3c906b9 on mking-clari:pagination into 776c8a0 on reactstrap:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 3c906b9 on mking-clari:pagination into 776c8a0 on reactstrap:master.

Comment thread src/PaginationLink.jsx Outdated
);

return (
<Tag {...attributes} className={classes}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add the aria label, the aria hidden attr and sr-only label for accessibility?

<a class="page-link" href="#" aria-label="Next">
    <span aria-hidden="true">&raquo;</span>
    <span class="sr-only">Next</span>
</a>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For prev/next, I don't think it will ever require children unless someone wants to override the carets. Could you setup rendering to be: if prev/next, include spans and render children instead of carets vs rendering children before the prev/next content.

@eddywashere
Copy link
Copy Markdown
Member

A few comments, let me know what you think. Great work!

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling dfbd977 on mking-clari:pagination into 776c8a0 on reactstrap:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling a34d5cb on mking-clari:pagination into 776c8a0 on reactstrap:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 9850e4f on mking-clari:pagination into 776c8a0 on reactstrap:master.

@mking-clari
Copy link
Copy Markdown
Contributor Author

@eddywashere Thanks for the feedback, I updated the code.

Some notes:

  • If previous or next is set, the children prop replaces just the caret, not all the spans. If the user wants full customization of the spans, they can just not set previous or next.
  • The aria-label prop is used for both the aria-label attribute and the .sr-only text.

Comment thread src/PaginationLink.jsx Outdated

let defaultCaret;
if (previous) {
defaultCaret = <span>&laquo;</span>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think these extra spans are needed anymore since it's taken care of with <span aria-hidden="true">{children || defaultCaret}</span>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't remember if &laquo; as a string will render html, might need html entity.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling d2570bb on mking-clari:pagination into 776c8a0 on reactstrap:master.

@mking-clari
Copy link
Copy Markdown
Contributor Author

@eddywashere For the &laquo; issue, I replaced the html entity with the unicode character (\u00ab), which should avoid the escaping issue. Also updated the test for consistency.

For the span issue, I added an array (keys required to avoid warning).

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 8fa5044 on mking-clari:pagination into 776c8a0 on reactstrap:master.

@eddywashere
Copy link
Copy Markdown
Member

👍

@eddywashere eddywashere merged commit fdc5c45 into reactstrap:master Aug 21, 2016
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