From a606f4e0cdaf0689774b14408fd3664c9ef6e06d Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Wed, 2 Dec 2020 13:33:09 +1300 Subject: [PATCH] pagination. --- webclient/src/pages/Results.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webclient/src/pages/Results.js b/webclient/src/pages/Results.js index a006b76..8a707a5 100644 --- a/webclient/src/pages/Results.js +++ b/webclient/src/pages/Results.js @@ -55,6 +55,13 @@ class Results extends React.Component { const stories = this.state.stories; const error = this.state.error; + const search = this.props.location.search; + const params = new URLSearchParams(search); + + const q = params.get('q') || ''; + const skip = params.get('skip') || 0; + const limit = params.get('limit') || 20; + return (
@@ -71,6 +78,11 @@ class Results extends React.Component { :

loading...

} + +
+ {Number(skip) > 0 && Previous} + {stories.length == Number(limit) && Next} +
); }