mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 07:32:40 +00:00
limit search and adapt ui
This commit is contained in:
@@ -25,6 +25,7 @@ const ArchivePage = createClass({
|
|||||||
brewCollection : null,
|
brewCollection : null,
|
||||||
searching : false,
|
searching : false,
|
||||||
error : null,
|
error : null,
|
||||||
|
limit : '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentDidMount : function() {
|
componentDidMount : function() {
|
||||||
@@ -38,10 +39,9 @@ const ArchivePage = createClass({
|
|||||||
},
|
},
|
||||||
lookup() {
|
lookup() {
|
||||||
this.setState({ searching: true, error: null });
|
this.setState({ searching: true, error: null });
|
||||||
|
|
||||||
request
|
request
|
||||||
.get(`/archive/${this.state.title}`)
|
.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 }))
|
.catch((err) => this.setState({ error: err }))
|
||||||
.finally(() => this.setState({ searching: false }));
|
.finally(() => this.setState({ searching: false }));
|
||||||
},
|
},
|
||||||
@@ -67,6 +67,9 @@ const ArchivePage = createClass({
|
|||||||
}
|
}
|
||||||
this.updateUrl();
|
this.updateUrl();
|
||||||
return <div className="foundBrews">
|
return <div className="foundBrews">
|
||||||
|
<div className="limit">
|
||||||
|
<p>{this.state.limit}</p>
|
||||||
|
</div>
|
||||||
{brews.map((brew, index) => (
|
{brews.map((brew, index) => (
|
||||||
<BrewItem brew={brew} key={index} reportError={this.props.reportError}/>
|
<BrewItem brew={brew} key={index} reportError={this.props.reportError}/>
|
||||||
))}
|
))}
|
||||||
@@ -84,11 +87,14 @@ const ArchivePage = createClass({
|
|||||||
type='text'
|
type='text'
|
||||||
value={this.state.title}
|
value={this.state.title}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
|
onKeyDown={(e) => e.key === 'Enter' && this.lookup()}
|
||||||
placeholder='v3 Reference Document'
|
placeholder='v3 Reference Document'
|
||||||
/>
|
/>
|
||||||
{/* In the future, we should be able to filter the results by adding tags.
|
{/* In the future, we should be able to filter the results by adding tags.
|
||||||
<label>Tags</label><input type='text' value={this.state.query} placeholder='add a tag to filter'/>
|
<label>Tags</label><input type='text' value={this.state.query} placeholder='add a tag to filter'/>
|
||||||
|
<input type="checkbox" id="v3" /><label>v3 only</label>
|
||||||
*/}
|
*/}
|
||||||
|
|
||||||
<button onClick={this.lookup}>
|
<button onClick={this.lookup}>
|
||||||
<i
|
<i
|
||||||
className={cx('fas', {
|
className={cx('fas', {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ body {
|
|||||||
.flexGroup {
|
.flexGroup {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 2fr;
|
grid-template-columns: 500px 2fr;
|
||||||
|
|
||||||
.dataGroup {
|
.dataGroup {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -81,6 +81,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.foundBrews {
|
.foundBrews {
|
||||||
|
position:relative;
|
||||||
background-color: #2C3E50;
|
background-color: #2C3E50;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -90,6 +91,22 @@ body {
|
|||||||
padding: 50px;
|
padding: 50px;
|
||||||
padding-bottom: unset;
|
padding-bottom: unset;
|
||||||
|
|
||||||
|
.limit {
|
||||||
|
position:fixed;
|
||||||
|
bottom:0;
|
||||||
|
left:502px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 800;
|
||||||
|
color:white;
|
||||||
|
background-color: #333;
|
||||||
|
padding: 8px 10px;
|
||||||
|
z-index: 1000;
|
||||||
|
|
||||||
|
&:has(p:empty) {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.brewItem {
|
.brewItem {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
min-height: unset;
|
min-height: unset;
|
||||||
@@ -103,14 +120,15 @@ body {
|
|||||||
min-height: unset;
|
min-height: unset;
|
||||||
width: 20vw;
|
width: 20vw;
|
||||||
padding-inline:10px;
|
padding-inline:10px;
|
||||||
|
height: 1.5em;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
|
|
||||||
@@ -181,6 +199,7 @@ body {
|
|||||||
height: max-content;
|
height: max-content;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
width:min-content;
|
width:min-content;
|
||||||
|
padding:10px;
|
||||||
|
|
||||||
span:nth-of-type(n+4) {
|
span:nth-of-type(n+4) {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const archive = {
|
|||||||
/* Searches for matching title, also attempts to partial match */
|
/* Searches for matching title, also attempts to partial match */
|
||||||
findBrews: async (req, res, next) => {
|
findBrews: async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const limit = 3;
|
const limit = 100;
|
||||||
const brews = await HomebrewModel.find({
|
const brews = await HomebrewModel.find({
|
||||||
title: { $regex: req.params.query, $options: 'i' },
|
title: { $regex: req.params.query, $options: 'i' },
|
||||||
published: true
|
published: true
|
||||||
|
|||||||
Reference in New Issue
Block a user