import {SelectBoxProps} from "@/shared/interface"; import {ChangeEvent, Dispatch, SetStateAction} from "react"; import InputField from "@/components/form/InputField"; import TextInput from "@/components/form/TextInput"; interface SuggestFieldInputProps { inputFieldName: string; inputFieldIcon?: any; searchTags: string; tagued: string[]; handleTagSearch: (e: ChangeEvent) => void; handleAddTag: (characterId: string) => void; handleRemoveTag: (characterId: string) => void; filteredTags: () => SelectBoxProps[]; showTagSuggestions: boolean; setShowTagSuggestions: Dispatch>; getTagLabel: (id: string) => string; } export default function SuggestFieldInput( { inputFieldName, inputFieldIcon, searchTags, tagued, handleTagSearch, handleAddTag, handleRemoveTag, filteredTags, showTagSuggestions, setShowTagSuggestions, getTagLabel }: SuggestFieldInputProps) { return (
setShowTagSuggestions(searchTags.trim().length > 0)} placeholder="Rechercher et ajouter..."/> {showTagSuggestions && filteredTags().length > 0 && (
{filteredTags().map((character: SelectBoxProps) => ( ))}
)}
}/>
{tagued.length === 0 ? (

Aucun élément ajouté

) : ( tagued.map((tag: string) => (
{getTagLabel(tag)}
)) )}
) }