You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
705 B
39 lines
705 B
export interface TextInputControlPropsNoLabel { |
|
onChange?: (data: string) => void; |
|
value?: string; |
|
placeholder?: string; |
|
className?: string; |
|
} |
|
|
|
export interface TextInputControlProps extends TextInputControlPropsNoLabel { |
|
label?: string; |
|
} |
|
|
|
export function TextInputControl({ |
|
onChange, |
|
value, |
|
label, |
|
className, |
|
placeholder, |
|
}: TextInputControlProps) { |
|
const input = ( |
|
<input |
|
type="text" |
|
className={className} |
|
placeholder={placeholder} |
|
onChange={(e) => onChange && onChange(e.target.value)} |
|
value={value} |
|
/> |
|
); |
|
|
|
if (label) { |
|
return ( |
|
<label> |
|
<span>{label}</span> |
|
{input} |
|
</label> |
|
); |
|
} |
|
|
|
return input; |
|
}
|
|
|