mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Update topbar.tsx
This commit is contained in:
@@ -35,6 +35,19 @@ const SearchBar = ({ setShowSearchBar }: { setShowSearchBar: (show: boolean) =>
|
|||||||
};
|
};
|
||||||
}, [handleClickOutside]);
|
}, [handleClickOutside]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleEscapeKey = (event: KeyboardEvent) => {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
setShowSearchBar(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('keydown', handleEscapeKey);
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('keydown', handleEscapeKey);
|
||||||
|
};
|
||||||
|
}, [setShowSearchBar]);
|
||||||
|
|
||||||
const handleSearchSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
const handleSearchSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const searchInput = searchInputRef.current?.value;
|
const searchInput = searchInputRef.current?.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user