Update + Delete articles
This commit is contained in:
@@ -24,7 +24,7 @@ interface ComboBoxProps<T> {
|
||||
trigger: (value?: string) => React.ReactNode;
|
||||
onSubmit?: (value: string) => void;
|
||||
value: string;
|
||||
setValue: React.Dispatch<React.SetStateAction<string>>;
|
||||
onValueChange: (v: string) => void;
|
||||
children: (
|
||||
ItemComponent: (
|
||||
props: React.ComponentProps<typeof CommandItem> & { label: string },
|
||||
@@ -39,7 +39,7 @@ const ComboBox = <T,>({
|
||||
children,
|
||||
onSubmit,
|
||||
value,
|
||||
setValue,
|
||||
onValueChange,
|
||||
}: ComboBoxProps<T>) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [searchValue, setSearchValue] = useState("");
|
||||
@@ -47,7 +47,7 @@ const ComboBox = <T,>({
|
||||
const handleSubmit = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key !== "Enter") return;
|
||||
e.preventDefault();
|
||||
setValue(searchValue);
|
||||
onValueChange(searchValue);
|
||||
onSubmit?.(searchValue);
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ const ComboBox = <T,>({
|
||||
key={index}
|
||||
value={elementValue ?? ""}
|
||||
onSelect={(_value) => {
|
||||
setValue(_value);
|
||||
onValueChange(_value);
|
||||
console.log(elementValue);
|
||||
setOpen(false);
|
||||
onSelect?.(_value);
|
||||
|
||||
Reference in New Issue
Block a user