Skip to content

Commit

Permalink
fix: review formInput inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
wilcorrea committed Apr 19, 2024
1 parent a3a64d6 commit 7d5b144
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions frontend/view/components/form/FormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function FormInput<T> (props: FormInputProps<T>) {
placeholder,
description,
fieldValue,
} = useFormComponent<string>(props)
} = useFormComponent<T>(props)

const { type = 'text' } = props

Expand All @@ -30,7 +30,7 @@ export function FormInput<T> (props: FormInputProps<T>) {
id={fieldId}
name={fieldName}
placeholder={placeholder}
value={fieldValue}
value={fieldValue as string | number}
onChange={onChange}
/>
{description && (<small className="form-text text-muted">{description}</small>)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/view/components/form/FormPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { FormFieldProps } from './index.ts'
import { FormInput } from './FormInput.tsx'

export function FormPassword (props: FormFieldProps<string>) {
return FormInput({ ...props, type: 'password' })
return FormInput<string>({ ...props, type: 'password' })
}
2 changes: 1 addition & 1 deletion frontend/view/components/form/FormText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { FormFieldProps } from './index.ts'
import { FormInput } from './FormInput.tsx'

export function FormText (props: FormFieldProps<string>) {
return FormInput({ ...props, type: 'text' })
return FormInput<string>({ ...props, type: 'text' })
}

0 comments on commit 7d5b144

Please sign in to comment.