fix: block empty tag searches
This commit is contained in:
parent
95d6275d4e
commit
e6a15c6b3d
2 changed files with 68 additions and 65 deletions
|
|
@ -39,7 +39,7 @@ export default function SearchResults({
|
|||
<div>Search Results</div>
|
||||
</SheetTitle>
|
||||
<SheetDescription className="flex flex-row gap-3">
|
||||
<div className="text-foreground">Search term:</div>
|
||||
<span className="text-foreground">Search term:</span>
|
||||
<span className="font-medium text-foreground">{searchParams}</span>
|
||||
</SheetDescription>
|
||||
</SheetHeader>
|
||||
|
|
@ -65,8 +65,8 @@ export default function SearchResults({
|
|||
</div>
|
||||
) : (
|
||||
<div className="p-4 pt-0 flex gap-2">
|
||||
{tagResults.map((tagResult) => (
|
||||
<Link to={`/tags/${tagResult}`}>
|
||||
{tagResults?.map((tagResult, i) => (
|
||||
<Link to={`/tags/${tagResult}`} key={i}>
|
||||
<Badge className="hover:bg-muted" variant="outline">
|
||||
{tagResult}
|
||||
</Badge>
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@ export default function Search() {
|
|||
onSubmit: ({ value }) => {
|
||||
setSearchParams(value.search)
|
||||
setSheetOpen(true)
|
||||
console.log(value.search)
|
||||
setTagResults(
|
||||
tags?.filter((tag) => tag.toLowerCase().includes(value.search.toLowerCase())),
|
||||
value.search !== ""
|
||||
? tags?.filter((tag) => tag.toLowerCase().includes(value.search.toLowerCase()))
|
||||
: null,
|
||||
)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue