File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
page-components/FavouritesPage Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 22 display : flex;
33 justify-content : space-evenly;
44 align-items : center;
5- margin-left : 50 % ;
5+ margin : 0 auto ;
66 margin-top : 10px ;
7+ margin-bottom : -10px ;
8+ width : 150px ;
79}
Original file line number Diff line number Diff line change @@ -22,19 +22,19 @@ export default function PaginationNav({
2222 return (
2323 < div className = "pagination-nav" >
2424 < button
25- className = "button--secondary"
25+ className = "button--secondary text-md "
2626 onClick = { navigateToPrevious }
2727 disabled = { pageNumber === 1 }
2828 >
29- previous
29+ { "<<<" }
3030 </ button >
31- < p className = "bold" > { `${ pageNumber } of ${ pageCount } ` } </ p >
31+ < p className = "bold text-lg " > { `${ pageNumber } of ${ pageCount } ` } </ p >
3232 < button
33- className = "button--secondary"
33+ className = "button--secondary text-md "
3434 onClick = { navigateToNext }
3535 disabled = { pageNumber === pageCount }
3636 >
37- next
37+ { ">>>" }
3838 </ button >
3939 </ div >
4040 )
Original file line number Diff line number Diff line change @@ -43,9 +43,13 @@ export default function FavouritesPage() {
4343
4444 if ( error ) return showBoundary ( error )
4545
46- setFavouritesList ( previous =>
47- previous . filter ( favourite => favourite . id !== givenId )
46+ const newFavourites = favouritesList . filter (
47+ favourite => favourite . id !== givenId
4848 )
49+ if ( newFavourites . length === 0 )
50+ setPageNumber ( previous => previous - 1 )
51+
52+ setFavouritesList ( newFavourites )
4953 }
5054
5155 useEffect ( ( ) => {
@@ -95,14 +99,14 @@ export default function FavouritesPage() {
9599 } )
96100
97101 if ( popupError ) return showBoundary ( popupError )
98- if ( meta . pagination . pageCount !== 1 )
102+ if ( meta . pagination . pageCount !== pageCount )
99103 setPageCount ( meta . pagination . pageCount )
100104
101105 setFavouritesList ( popupData )
102106 }
103107
104108 getFavourites ( )
105- } , [ setFavouritesList , pageNumber ] )
109+ } , [ setFavouritesList , pageNumber , favouritesList . length % 6 === 0 ] )
106110
107111 return (
108112 < div className = "favourites-page page" >
You can’t perform that action at this time.
0 commit comments