Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stacey-gammon committed May 19, 2017
1 parent 9d36460 commit 344a3bb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
11 changes: 6 additions & 5 deletions ui_framework/components/pager/pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ export function KuiPager({
hasNextPage,
onNextPage,
onPreviousPage,
...rest }) {
...rest,
}) {
const classes = classNames('kuiPager', className);
return (
<div className={classes} { ...rest }>
<div className="kuiPagerText">{startNumber}&ndash;{endNumber} of {totalItems}</div>
{
startNumber === 1 && endNumber === totalItems
(startNumber === 1 && endNumber === totalItems)
? null
: <KuiPagerButtonGroup
hasNext={hasNextPage}
Expand All @@ -32,9 +33,9 @@ export function KuiPager({
}

KuiPager.propTypes = {
startNumber: React.PropTypes.number,
endNumber: React.PropTypes.number,
totalItems: React.PropTypes.number,
startNumber: React.PropTypes.number.isRequired,
endNumber: React.PropTypes.number.isRequired,
totalItems: React.PropTypes.number.isRequired,
hasPreviousPage: React.PropTypes.bool.isRequired,
hasNextPage: React.PropTypes.bool.isRequired,
onNextPage: React.PropTypes.func.isRequired,
Expand Down
2 changes: 2 additions & 0 deletions ui_framework/components/pager/pager_button_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ export function KuiPagerButtonGroup({ className, onPrevious, onNext, hasNext, ha
return (
<KuiButtonGroup isUnited className={className} { ...rest }>
<KuiButton
aria-label="Show previous page"
data-test-subj="pagerPreviousButton"
type="basic"
onClick={onPrevious}
disabled={!hasPrevious}
icon={<KuiButtonIcon type="previous" />}
/>
<KuiButton
aria-label="Show next page"
data-test-subj="pagerNextButton"
type="basic"
onClick={onNext}
Expand Down
1 change: 1 addition & 0 deletions ui_framework/doc_site/src/services/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ const components = [{
}, {
name: 'Pager',
component: PagerExample,
hasReact: true,
}, {
name: 'Panel',
component: PanelExample,
Expand Down
4 changes: 2 additions & 2 deletions ui_framework/doc_site/src/views/pager/pager_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default props => (
}]}
>
<GuideText>
Use the Pager in a tool bar
Use the Pager in a tool bar.
</GuideText>

<GuideDemo>
Expand All @@ -49,7 +49,7 @@ export default props => (
}]}
>
<GuideText>
Use the Pager Buttons to navigate through a set of items
Use the Pager Buttons to navigate through a set of items.
</GuideText>

<GuideDemo>
Expand Down

0 comments on commit 344a3bb

Please sign in to comment.