mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-10 06:10:17 -04:00
added search functionality for tags
This commit is contained in:
parent
167fa009ae
commit
b86e5257f9
|
@ -20,9 +20,12 @@ const TagsInput: React.FC<TagsInputProps> = ({
|
||||||
const [options, setOptions] = useState<Set<string>>(new Set(presetOptions));
|
const [options, setOptions] = useState<Set<string>>(new Set(presetOptions));
|
||||||
|
|
||||||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setInputValue(e.target.value);
|
setOptions(() => {
|
||||||
|
const newOptions = presetOptions.filter(item => item.includes(e.target.value.toLowerCase()));
|
||||||
|
return new Set(newOptions);
|
||||||
|
})
|
||||||
|
setInputValue(e.target.value); // Update input value state
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddTag = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
const handleAddTag = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
if (e.key === "Enter" && inputValue.trim()) {
|
if (e.key === "Enter" && inputValue.trim()) {
|
||||||
setTags((prevTags) => new Set(prevTags).add(inputValue));
|
setTags((prevTags) => new Set(prevTags).add(inputValue));
|
||||||
|
|
1
compass/package-lock.json
generated
1
compass/package-lock.json
generated
|
@ -4395,4 +4395,3 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user