Update + Delete articles

This commit is contained in:
cdricms
2025-02-25 17:49:37 +01:00
parent 793e3748f9
commit a3f716446c
16 changed files with 764 additions and 3357 deletions

View File

@@ -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);