Skip to content

Commit

Permalink
remove first/last button options
Browse files Browse the repository at this point in the history
  • Loading branch information
Eszter Hofmann committed May 10, 2019
1 parent 5af3f44 commit b9cf18e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 106 deletions.
32 changes: 0 additions & 32 deletions src/components/Pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const Pagination = props => {
totalPages,
prevLabel,
nextLabel,
lastLabel,
firstLabel,
onClick,
...rest
} = props;
Expand Down Expand Up @@ -67,18 +65,6 @@ const Pagination = props => {

return (
<nav {...rest} {...block(props)} aria-label="pagination">
{!!firstLabel && (
<Button
{...elem('button', props)}
onClick={handleClick}
disabled={isPrevDisabled}
context="link"
data-page={1}
aria-disabled={isPrevDisabled}
>
{`\u00ab ${firstLabel}`}
</Button>
)}
{!!prevLabel && (
<Button
{...elem('button', props)}
Expand Down Expand Up @@ -126,18 +112,6 @@ const Pagination = props => {
{`${nextLabel} \u203a`}
</Button>
)}
{!!lastLabel && (
<Button
{...elem('button', props)}
onClick={handleClick}
disabled={isNextDisabled}
context="link"
data-page={totalPages}
aria-disabled={isNextDisabled}
>
{`${lastLabel} \u00bb`}
</Button>
)}
</nav>
);
};
Expand All @@ -157,10 +131,6 @@ Pagination.propTypes = {
prevLabel: PropTypes.string,
/** Label for 'Next page' button (required for button to show) */
nextLabel: PropTypes.string,
/** Label for 'First page' button (required for button to show) */
firstLabel: PropTypes.string,
/** Label for 'Last page' button (required for button to show) */
lastLabel: PropTypes.string,
/** Callback function on page / prev/ next click */
onClick: PropTypes.func
};
Expand All @@ -171,8 +141,6 @@ Pagination.defaultProps = {
maxPageButtons: 10,
prevLabel: null,
nextLabel: null,
firstLabel: null,
lastLabel: null,
onClick: null
};

Expand Down
18 changes: 0 additions & 18 deletions src/components/Pagination/__tests__/Pagination.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ describe('<Pagination> that renders a pagination component', () => {
onClick={onClick}
prevLabel="Previous"
nextLabel="Next"
firstLabel="First"
lastLabel="Last"
/>
);
});
Expand Down Expand Up @@ -66,14 +64,6 @@ describe('<Pagination> that renders a pagination component', () => {
});
});
describe('data-page property of buttons', () => {
it('should be set correctly on First', () => {
expect(
wrapper
.findWhere(el => el.text() === `\u00ab First`)
.find('button')
.prop('data-page')
).toBe(1);
});
it('should be set correctly on Prev button', () => {
expect(
wrapper
Expand All @@ -90,14 +80,6 @@ describe('<Pagination> that renders a pagination component', () => {
.prop('data-page')
).toBe(CURRENT_PAGE + 1);
});
it('should be set correctly on Last button', () => {
expect(
wrapper
.findWhere(el => el.text() === `Last \u00bb`)
.find('button')
.prop('data-page')
).toBe(20);
});
it('should be set correctly on "page 1" button', () => {
expect(
wrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ exports[`<Pagination> that renders a pagination component should render correctl
<Pagination
align="center"
currentPage={6}
firstLabel="First"
lastLabel="Last"
maxPageButtons={8}
nextLabel="Next"
onClick={[MockFunction]}
Expand All @@ -16,31 +14,6 @@ exports[`<Pagination> that renders a pagination component should render correctl
aria-label="pagination"
className="Pagination Pagination--align Pagination--align_center"
>
<Button
aria-disabled={false}
className="Pagination__button Pagination__button--align Pagination__button--align_center"
context="link"
data-page={1}
disabled={false}
href={null}
isBlock={false}
isInline={false}
onClick={[Function]}
size="normal"
type="button"
>
<button
aria-disabled={false}
className="Button Button--context Button--context_link Button--size Button--size_normal Pagination__button Pagination__button--align Pagination__button--align_center"
data-page={1}
disabled={false}
onClick={[Function]}
size="normal"
type="button"
>
« First
</button>
</Button>
<Button
aria-disabled={false}
className="Pagination__button Pagination__button--align Pagination__button--align_center"
Expand Down Expand Up @@ -352,31 +325,6 @@ exports[`<Pagination> that renders a pagination component should render correctl
Next ›
</button>
</Button>
<Button
aria-disabled={false}
className="Pagination__button Pagination__button--align Pagination__button--align_center"
context="link"
data-page={20}
disabled={false}
href={null}
isBlock={false}
isInline={false}
onClick={[Function]}
size="normal"
type="button"
>
<button
aria-disabled={false}
className="Button Button--context Button--context_link Button--size Button--size_normal Pagination__button Pagination__button--align Pagination__button--align_center"
data-page={20}
disabled={false}
onClick={[Function]}
size="normal"
type="button"
>
Last »
</button>
</Button>
</nav>
</Pagination>
`;
Expand All @@ -385,8 +333,6 @@ exports[`<Pagination> that renders a pagination component should render correctl
<Pagination
align="center"
currentPage={1}
firstLabel={null}
lastLabel={null}
maxPageButtons={10}
nextLabel={null}
onClick={null}
Expand Down
2 changes: 0 additions & 2 deletions stories/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ storiesOf('Pagination', module)
}}
prevLabel={text('Previous label', 'Previous')}
nextLabel={text('Next label', 'Next')}
firstLabel={text('First label', 'First')}
lastLabel={text('Last label', 'Last')}
/>
));

0 comments on commit b9cf18e

Please sign in to comment.