diff --git a/apps/hub/app/(app)/admin/keyword/_components/Form.tsx b/apps/hub/app/(app)/admin/keyword/_components/Form.tsx index e54d0189..395b3f48 100644 --- a/apps/hub/app/(app)/admin/keyword/_components/Form.tsx +++ b/apps/hub/app/(app)/admin/keyword/_components/Form.tsx @@ -10,6 +10,7 @@ import { useState } from "react"; import { deleteKeyword, upsertKeyword } from "../action"; import { Button } from "../../../../_components/ui/Button"; import { redirect } from "next/navigation"; +import { ListInput } from "_components/ui/List"; export const KeywordForm = ({ keyword }: { keyword?: Keyword }) => { const form = useForm>({ @@ -69,11 +70,11 @@ export const KeywordForm = ({ keyword }: { keyword?: Keyword }) => { name="description" className="input-sm" /> - diff --git a/apps/hub/app/_components/ui/List.tsx b/apps/hub/app/_components/ui/List.tsx new file mode 100644 index 00000000..f11b5b76 --- /dev/null +++ b/apps/hub/app/_components/ui/List.tsx @@ -0,0 +1,88 @@ +import DatePicker, { DatePickerProps, registerLocale } from "react-datepicker"; +import { + Control, + Controller, + FieldValues, + Path, + PathValue, +} from "react-hook-form"; +import { de } from "date-fns/locale"; +import { useState } from "react"; +import { cn } from "../../../helper/cn"; +registerLocale("de", de); + +interface ListInputProps + extends Omit { + control: Control; + name: Path; + label?: string; +} + +export const ListInput = ({ + control, + name, + label, + ...props +}: ListInputProps) => { + const [value, setValue] = useState(""); + return ( + { + return ( +
+ {label} +
+ setValue(e.target.value)} + /> + +
+
+ {field.value?.map((item: string, index: number) => ( +
+ { + const value = [...field.value]; + value[index] = e.target.value; + field.onChange(value); + }} + /> + +
+ ))} +
+
+ ); + }} + /> + ); +}; diff --git a/grafana/grafana.db b/grafana/grafana.db index 664833f9..369220d6 100644 Binary files a/grafana/grafana.db and b/grafana/grafana.db differ