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();
|
||||
}, []);
|
||||
const [color, setColor] = useState('black');
|
||||
|
||||
const selectRef = useRef(null);
|
||||
const [currentTag, setCurrentTag] = useState<string>('');
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
|
||||
if (event.key === 'ArrowUp') {
|
||||
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
||||
const newIndex = currentIndex === 0 ? tags.length - 1 : currentIndex - 1;
|
||||
@ -74,11 +75,13 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnable
|
||||
}
|
||||
else if(event.key === 'Enter'){
|
||||
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
||||
if (currentIndex !== -1 && !selectedTags.includes(tags[currentIndex].name)) {
|
||||
setSelectedTags([...selectedTags, tags[currentIndex].name]);
|
||||
const tagsInput = selectedTagsInput;
|
||||
tagsInput.push({ value: tags[currentIndex].name, label: tags[currentIndex].name });
|
||||
setSelectedTagsInput(tagsInput);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
|
Loading…
x
Reference in New Issue
Block a user