From 0a42d34bb414d18095295f8e97c7fe22fe36847c Mon Sep 17 00:00:00 2001 From: Brandon Egger Date: Tue, 6 Jun 2023 00:40:50 -0500 Subject: [PATCH] update InfoInputLine to work with use-react-form --- src/components/admin/resources/form.tsx | 2 ++ src/components/forms/textInput.tsx | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/components/admin/resources/form.tsx b/src/components/admin/resources/form.tsx index 8aa3672..8e1d4bc 100644 --- a/src/components/admin/resources/form.tsx +++ b/src/components/admin/resources/form.tsx @@ -127,12 +127,14 @@ function ResourceSummarySubForm({ ({ value, placeholder, hint, + details, }: { value: string; placeholder: string; hint?: string; -}) => { - const [currentValue, setCurrentValue] = useState(value); + details: UseFormRegisterReturn; +}) { + const [curValue, setCurValue] = useState(value); return (
{ - setCurrentValue(event.target.value); + setCurValue(event.target.value); + details.onChange(event).catch((e) => { + console.error(e); + }); }} placeholder={placeholder} - value={currentValue} type="text" className="w-full border-b border-neutral-300 px-2" />
); -}; +} export { InfoInputLine };