mirror of
https://github.com/D4M13N-D3V/neroshitron.git
synced 2025-03-14 10:05:04 +00:00
Merge branch 'main' of https://github.com/D4M13N-D3V/neroshitron
This commit is contained in:
commit
172a3015af
@ -58,11 +58,12 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnable
|
|||||||
getData();
|
getData();
|
||||||
}, []);
|
}, []);
|
||||||
const [color, setColor] = useState('black');
|
const [color, setColor] = useState('black');
|
||||||
|
const selectRef = useRef(null);
|
||||||
const [currentTag, setCurrentTag] = useState<string>('');
|
const [currentTag, setCurrentTag] = useState<string>('');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (event: KeyboardEvent) => {
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
|
|
||||||
if (event.key === 'ArrowUp') {
|
if (event.key === 'ArrowUp') {
|
||||||
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
||||||
const newIndex = currentIndex === 0 ? tags.length - 1 : currentIndex - 1;
|
const newIndex = currentIndex === 0 ? tags.length - 1 : currentIndex - 1;
|
||||||
@ -74,10 +75,12 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnable
|
|||||||
}
|
}
|
||||||
else if(event.key === 'Enter'){
|
else if(event.key === 'Enter'){
|
||||||
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
||||||
setSelectedTags([...selectedTags, tags[currentIndex].name]);
|
if (currentIndex !== -1 && !selectedTags.includes(tags[currentIndex].name)) {
|
||||||
const tagsInput = selectedTagsInput;
|
setSelectedTags([...selectedTags, tags[currentIndex].name]);
|
||||||
tagsInput.push({value: tags[currentIndex].name, label: tags[currentIndex].name});
|
const tagsInput = selectedTagsInput;
|
||||||
setSelectedTagsInput(tagsInput);
|
tagsInput.push({ value: tags[currentIndex].name, label: tags[currentIndex].name });
|
||||||
|
setSelectedTagsInput(tagsInput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user