mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 03:10:15 +01:00
minor fixes (#318)
* refactor(SearchBar.jsx): extract onChange function to a separate function and add onKeyDown event listener to prevent spacebar from propagating * refactor(SearchBar.jsx): extract onChange function to a separate function and add onKeyDown event listener to prevent spacebar from propagating * refactor(SearchBar.jsx): remove unused React import statement
This commit is contained in:
parent
47533736e3
commit
d71b61ad71
2 changed files with 17 additions and 6 deletions
|
|
@ -13,6 +13,11 @@ export default function SearchBar({ clearSearch }) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onChange = (e) => {
|
||||||
|
const { value } = e.target;
|
||||||
|
setSearchQuery(value);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex cursor-pointer items-center gap-3 rounded-md px-3 py-3 text-sm text-white transition-colors duration-200 hover:bg-gray-500/10">
|
<div className="flex cursor-pointer items-center gap-3 rounded-md px-3 py-3 text-sm text-white transition-colors duration-200 hover:bg-gray-500/10">
|
||||||
{<Search className="h-4 w-4" />}
|
{<Search className="h-4 w-4" />}
|
||||||
|
|
@ -20,7 +25,10 @@ export default function SearchBar({ clearSearch }) {
|
||||||
type="text"
|
type="text"
|
||||||
className="m-0 mr-0 w-full border-none bg-transparent p-0 text-sm leading-tight outline-none"
|
className="m-0 mr-0 w-full border-none bg-transparent p-0 text-sm leading-tight outline-none"
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={onChange}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
e.code === 'Space' ? e.stopPropagation() : null;
|
||||||
|
}}
|
||||||
placeholder="Search messages"
|
placeholder="Search messages"
|
||||||
onKeyUp={handleKeyUp}
|
onKeyUp={handleKeyUp}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
13
package-lock.json
generated
13
package-lock.json
generated
|
|
@ -59,7 +59,7 @@
|
||||||
"keyv": "^4.5.2",
|
"keyv": "^4.5.2",
|
||||||
"keyv-file": "^0.2.0",
|
"keyv-file": "^0.2.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"meilisearch": "^0.31.1",
|
"meilisearch": "^0.32.3",
|
||||||
"mongoose": "^6.9.0",
|
"mongoose": "^6.9.0",
|
||||||
"nodemailer": "^6.9.1",
|
"nodemailer": "^6.9.1",
|
||||||
"openai": "^3.1.0",
|
"openai": "^3.1.0",
|
||||||
|
|
@ -12419,8 +12419,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/meilisearch": {
|
"node_modules/meilisearch": {
|
||||||
"version": "0.31.1",
|
"version": "0.32.3",
|
||||||
"license": "MIT",
|
"resolved": "https://registry.npmjs.org/meilisearch/-/meilisearch-0.32.3.tgz",
|
||||||
|
"integrity": "sha512-EOgfBuRE5SiIPIpEDYe2HO0D7a4z5bexIgaAdJFma/dH5hx1kwO+u/qb2g3qKyjG+iA3l8MlmTj/Xd72uahaAw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-fetch": "^3.1.5"
|
"cross-fetch": "^3.1.5"
|
||||||
}
|
}
|
||||||
|
|
@ -22633,7 +22634,7 @@
|
||||||
"keyv": "^4.5.2",
|
"keyv": "^4.5.2",
|
||||||
"keyv-file": "^0.2.0",
|
"keyv-file": "^0.2.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"meilisearch": "^0.31.1",
|
"meilisearch": "^0.32.3",
|
||||||
"mongoose": "^6.9.0",
|
"mongoose": "^6.9.0",
|
||||||
"nodemailer": "^6.9.1",
|
"nodemailer": "^6.9.1",
|
||||||
"nodemon": "^2.0.20",
|
"nodemon": "^2.0.20",
|
||||||
|
|
@ -26496,7 +26497,9 @@
|
||||||
"version": "0.3.0"
|
"version": "0.3.0"
|
||||||
},
|
},
|
||||||
"meilisearch": {
|
"meilisearch": {
|
||||||
"version": "0.31.1",
|
"version": "0.32.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/meilisearch/-/meilisearch-0.32.3.tgz",
|
||||||
|
"integrity": "sha512-EOgfBuRE5SiIPIpEDYe2HO0D7a4z5bexIgaAdJFma/dH5hx1kwO+u/qb2g3qKyjG+iA3l8MlmTj/Xd72uahaAw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cross-fetch": "^3.1.5"
|
"cross-fetch": "^3.1.5"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue