Skip to content

Commit

Permalink
Replace local pagination component with one from shared library
Browse files Browse the repository at this point in the history
Replace `PaginationNavigation` with `Pagination` component from
@hypothesis/frontend-shared. This has an identical look and props, since this
component was copied from `PaginationNavigation` originally.
  • Loading branch information
robertknight committed Dec 10, 2024
1 parent d02d345 commit c9e9d6d
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 407 deletions.
8 changes: 3 additions & 5 deletions src/sidebar/components/PaginatedThreadList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Pagination } from '@hypothesis/frontend-shared';
import { useMemo } from 'preact/hooks';

import type { Thread } from '../helpers/build-thread';
import { countVisible } from '../helpers/thread';
import PaginationNavigation from './PaginationNavigation';
import ThreadList from './ThreadList';

export type PaginatedThreadListProps = {
Expand All @@ -19,7 +19,7 @@ export type PaginatedThreadListProps = {
*
* Render the threads for the current page of results, and pagination controls.
*/
function PaginatedThreadList({
export default function PaginatedThreadList({
currentPage,
isLoading,
onChangePage,
Expand All @@ -41,7 +41,7 @@ function PaginatedThreadList({
<>
<ThreadList threads={paginatedThreads} />
{!isLoading && (
<PaginationNavigation
<Pagination
currentPage={currentPage}
onChangePage={onChangePage}
totalPages={totalPages}
Expand All @@ -50,5 +50,3 @@ function PaginatedThreadList({
</>
);
}

export default PaginatedThreadList;
146 changes: 0 additions & 146 deletions src/sidebar/components/PaginationNavigation.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/sidebar/components/test/PaginatedThreadList-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('PaginatedThreadList', () => {
const wrapper = createComponent(componentProps);

assert.equal(
wrapper.find('PaginationNavigation').props().totalPages,
wrapper.find('Pagination').props().totalPages,
testCase.pageCount,
);
});
Expand All @@ -121,7 +121,7 @@ describe('PaginatedThreadList', () => {
});

assert.equal(
wrapper.find('PaginationNavigation').props().currentPage,
wrapper.find('Pagination').props().currentPage,
testCase.currentPage,
);
});
Expand Down
159 changes: 0 additions & 159 deletions src/sidebar/components/test/PaginationNavigation-test.js

This file was deleted.

Loading

0 comments on commit c9e9d6d

Please sign in to comment.