import {SelectBoxProps} from "@/components/form/SelectBox"; import React, {ChangeEvent, Dispatch, SetStateAction} from "react"; import {LucideIcon} from "lucide-react"; import InputField from "@/components/form/InputField"; import TextInput from "@/components/form/TextInput"; import Badge from "@/components/ui/Badge"; interface SuggestFieldInputProps { inputFieldName: string; inputFieldIcon?: LucideIcon; 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)} )) )}
) }