File tree Expand file tree Collapse file tree 1 file changed +8
-16
lines changed
Expand file tree Collapse file tree 1 file changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,10 @@ export default function Header(
3535 currentPage,
3636 totalPages,
3737 } = props ;
38+
39+ const isAtStart = props . state ?. atStart ;
40+ const isAtEnd = props . state ?. atEnd ;
41+
3842 const iconFill = useColorModeValue (
3943 'ui.gray.icon' ,
4044 'ui.white' ,
@@ -81,18 +85,6 @@ export default function Header(
8185 }
8286 } ;
8387
84- const pageUp = ( ) => {
85- if ( currentPage > 1 ) {
86- navigator . goBackward ( ) ;
87- }
88- } ;
89-
90- const pageDown = ( ) => {
91- if ( currentPage < totalPages ) {
92- navigator . goForward ( ) ;
93- }
94- } ;
95-
9688 return (
9789 < HeaderWrapper
9890 bg = { mainBgColor }
@@ -138,9 +130,9 @@ export default function Header(
138130 < HStack mx = "auto" spacing = { 2 } >
139131 < Tooltip content = "Previous page" >
140132 < Button
141- onClick = { pageUp }
133+ onClick = { navigator . goBackward }
142134 aria-label = "Previous page"
143- isDisabled = { currentPage <= 1 }
135+ isDisabled = { isAtStart }
144136 isIcon
145137 >
146138 < Icon as = { PageUp } w = { 18 } h = { 18 } />
@@ -170,9 +162,9 @@ export default function Header(
170162 </ HStack >
171163 < Tooltip content = "Next page" >
172164 < Button
173- onClick = { pageDown }
165+ onClick = { navigator . goForward }
174166 aria-label = "Next page"
175- isDisabled = { currentPage >= totalPages }
167+ isDisabled = { isAtEnd }
176168 isIcon
177169 >
178170 < Icon as = { PageDown } w = { 18 } h = { 18 } />
You can’t perform that action at this time.
0 commit comments