mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-27 15:47:41 +01:00
24 lines
530 B
TypeScript
24 lines
530 B
TypeScript
|
export interface TextInputControlPropsNoLabel {
|
||
|
onChange?: (data: string) => void;
|
||
|
value?: string;
|
||
|
}
|
||
|
|
||
|
export interface TextInputControlProps extends TextInputControlPropsNoLabel {
|
||
|
label?: string;
|
||
|
}
|
||
|
|
||
|
export function TextInputControl({ onChange, value, label }: TextInputControlProps) {
|
||
|
const input = <input type="text" onChange={(e) => onChange && onChange(e.target.value)} value={value} />
|
||
|
|
||
|
if (label) {
|
||
|
return (
|
||
|
<label>
|
||
|
<span>{label}</span>
|
||
|
{input}
|
||
|
</label>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
return input;
|
||
|
}
|