-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
865ca93
commit e2cd9f2
Showing
21 changed files
with
806 additions
and
696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { useContext } from 'react'; | ||
import { useMediaQuery } from 'react-responsive'; | ||
import PaginationContext from './PaginationContext'; | ||
import PreviousPageButton from './subcomponents/PreviousPageButton'; | ||
import NextPageButton from './subcomponents/NextPageButton'; | ||
import PageOfCountButton from './subcomponents/PageOfCountButton'; | ||
import breakpoints from '../utils/breakpoints'; | ||
import { ELLIPSIS } from './constants'; | ||
import Ellipsis from './subcomponents/Ellipsis'; | ||
import newId from '../utils/newId'; | ||
import PageButton from './subcomponents/PageButton'; | ||
|
||
export default function DefaultPagination() { | ||
return ( | ||
<ul className="pagination"> | ||
<PreviousPageButton /> | ||
<PaginationPages /> | ||
<NextPageButton /> | ||
</ul> | ||
); | ||
} | ||
|
||
function PaginationPages() { | ||
const { displayPages } = useContext(PaginationContext); | ||
const isMobile = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth }); | ||
|
||
if (isMobile) { | ||
return <PageOfCountButton />; | ||
} | ||
|
||
return ( | ||
<> | ||
{displayPages.map((pageIndex) => { | ||
if (pageIndex === ELLIPSIS) { | ||
return <Ellipsis key={newId('pagination-ellipsis-')} />; | ||
} | ||
return <PageButton key={pageIndex} pageNum={pageIndex + 1} />; | ||
})} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import PreviousPageButton from './subcomponents/PreviousPageButton'; | ||
import NextPageButton from './subcomponents/NextPageButton'; | ||
|
||
export default function MinimalPagination() { | ||
return ( | ||
<ul className="pagination"> | ||
<PreviousPageButton /> | ||
<NextPageButton /> | ||
</ul> | ||
); | ||
} |
Oops, something went wrong.