From 89fddd02101e0a1873ee30a66bc5200b22fb4221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Wed, 24 Jan 2024 21:15:26 +0100 Subject: [PATCH] limit search and adapt ui --- .../pages/archivePage/archivePage.jsx | 10 ++++++-- .../pages/archivePage/archivePage.less | 25 ++++++++++++++++--- server/archive.api.js | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/client/homebrew/pages/archivePage/archivePage.jsx b/client/homebrew/pages/archivePage/archivePage.jsx index 10c1afb03..80bab8619 100644 --- a/client/homebrew/pages/archivePage/archivePage.jsx +++ b/client/homebrew/pages/archivePage/archivePage.jsx @@ -25,6 +25,7 @@ const ArchivePage = createClass({ brewCollection : null, searching : false, error : null, + limit : '', }; }, componentDidMount : function() { @@ -38,10 +39,9 @@ const ArchivePage = createClass({ }, lookup() { this.setState({ searching: true, error: null }); - request .get(`/archive/${this.state.title}`) - .then((res) => this.setState({ brewCollection: res.body })) + .then((res) => this.setState({ brewCollection: res.body.brews }, this.setState({ limit: res.body.message}))) .catch((err) => this.setState({ error: err })) .finally(() => this.setState({ searching: false })); }, @@ -67,6 +67,9 @@ const ArchivePage = createClass({ } this.updateUrl(); return
+
+

{this.state.limit}

+
{brews.map((brew, index) => ( ))} @@ -84,11 +87,14 @@ const ArchivePage = createClass({ type='text' value={this.state.title} onChange={this.handleChange} + onKeyDown={(e) => e.key === 'Enter' && this.lookup()} placeholder='v3 Reference Document' /> {/* In the future, we should be able to filter the results by adding tags. + */} +