diff --git a/src/components/inputs/ConfigurableInput.tsx b/src/components/inputs/ConfigurableInput.tsx index dc31411..7203b46 100644 --- a/src/components/inputs/ConfigurableInput.tsx +++ b/src/components/inputs/ConfigurableInput.tsx @@ -51,6 +51,7 @@ export default function ConfigurableInput(props: ConfigurableInputProps) { key={input.title} {...input} onChange={handleChange} + defaultValue={input.defaultValue} section={props.section} /> ); diff --git a/src/components/inputs/NumberInput.tsx b/src/components/inputs/NumberInput.tsx index ebfdb26..bd03d6a 100644 --- a/src/components/inputs/NumberInput.tsx +++ b/src/components/inputs/NumberInput.tsx @@ -2,6 +2,7 @@ import React from 'react'; import BaseInputProps from './BaseInputProps'; export interface NumberInputProps extends BaseInputProps { + value?: number; min?: number; max?: number; defaultValue?: number; @@ -9,17 +10,19 @@ export interface NumberInputProps extends BaseInputProps { export default function NumberInput(data: NumberInputProps) { function handleChange(e: React.ChangeEvent) { - data.onChange(e.currentTarget.value); e.preventDefault(); + data.onChange(e.currentTarget.value); } + console.log(data); + return ( diff --git a/src/components/inputs/StringInput.tsx b/src/components/inputs/StringInput.tsx index aefffa8..16a94bb 100644 --- a/src/components/inputs/StringInput.tsx +++ b/src/components/inputs/StringInput.tsx @@ -23,6 +23,8 @@ export default function StringInput(props: StringInputProps) { onChange={handleChange} defaultValue={data?.defaultValue || ''} value={data?.value || ''} - > + maxlength={props.max} + minlength={props.min} + /> ); }