0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-28 17:52:38 +00:00

"Rename searchButtonRef to submitButtonRef and update references"

This commit is contained in:
Víctor Losada Hernández
2024-09-01 11:19:00 +02:00
parent 3fc2e5202e
commit b6e904c9c8

View File

@@ -32,7 +32,7 @@ const VaultPage = (props) => {
const countRef = useRef(null);
const v3Ref = useRef(null);
const legacyRef = useRef(null);
const searchButtonRef = useRef(null);
const submitButtonRef = useRef(null);
useEffect(() => {
disableSubmitIfFormInvalid();
@@ -183,11 +183,8 @@ const VaultPage = (props) => {
pattern=".{3,}"
title="At least 3 characters"
onKeyDown={(e) => {
if (e.key === 'Enter') {
if (!searchButtonRef.current.disabled) {
loadPage(1, true, true);
}
}
if (e.key === 'Enter' && !submitButtonRef.current.disabled)
loadPage(1, true, true);
}}
placeholder="v3 Reference Document"
/>
@@ -203,11 +200,8 @@ const VaultPage = (props) => {
defaultValue={author}
onKeyUp={disableSubmitIfFormInvalid}
onKeyDown={(e) => {
if (e.key === 'Enter') {
if (!searchButtonRef.current.disabled) {
loadPage(1, true, true);
}
}
if (e.key === 'Enter' && !submitButtonRef.current.disabled)
loadPage(1, true, true);
}}
placeholder="Gazook89"
/>
@@ -247,7 +241,7 @@ const VaultPage = (props) => {
<button
id="searchButton"
ref={searchButtonRef}
ref={submitButtonRef}
onClick={() => {
loadPage(1, true, true);
}}