Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
feat(search): 💄 show/hide next-previous buttons based on context
Browse files Browse the repository at this point in the history
  • Loading branch information
filipowm committed Jun 13, 2020
1 parent 396048f commit 7a45498
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Search/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Button = styled(({ refine, page, children, ...props }) => {
})`
width: 32px;
height: 32px;
visibility: ${(props) => props.visible || props.visible === undefined ? 'visible' : 'hidden' };
vertical-align: middle;
transition: ${(props) => props.theme.transitions.hover};
background-color: ${(props) =>
Expand Down Expand Up @@ -71,7 +72,7 @@ const Pagination = ({ totalPages, nbPages, currentPage, refine, showPrevious, sh
<PagesList>
{showPrevious ? (
<li style={{ marginRight: leftRightMargin }}>
<Button refine={refine} page={previousPage}>
<Button visible={currentPage > 1} refine={refine} page={previousPage}>
<ChevronLeft />
</Button>
</li>
Expand All @@ -90,7 +91,7 @@ const Pagination = ({ totalPages, nbPages, currentPage, refine, showPrevious, sh
})}
{showNext ? (
<li style={{ marginLeft: leftRightMargin }}>
<Button refine={refine} page={nextPage}>
<Button visible={currentPage !== pagesToShow} refine={refine} page={nextPage}>
<ChevronRight />
</Button>
</li>
Expand Down

0 comments on commit 7a45498

Please sign in to comment.