This commit is contained in:
gingervitis
2020-12-26 19:44:09 -08:00
committed by Gabe Kangas
parent f446385a7e
commit f63fe9ea7b
3 changed files with 58 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
- auto saves ,ajax call
- auto saves ,ajax call (submit when blur or onEnter)
- set default text
- show error state/confirm states
- show info
@@ -16,10 +16,49 @@ update vals to state, andthru api.
*/
import React, { useContext } from 'react';
import { ServerStatusContext } from '../../../utils/server-status-context';
import React from 'react';
import { Form, Input } from 'antd';
interface TextFieldProps {
onSubmit: (value: string) => void;
label: string;
defaultValue: string;
value: string;
helpInfo: string;
maxLength: number;
type: string;
}
Server Name
<Input placeholder="Owncast" value={name} />
// // do i need this?
// export const initialProps: TextFieldProps = {
// }
export const TEXTFIELD_TYPE_TEXT = 'default';
export const TEXTFIELD_TYPE_PASSWORD = 'password'; //Input.Password
export const TEXTFIELD_TYPE_NUMBER = 'numeric';
export default function TextField(props: TextFieldProps) {
const {
label,
defaultValue,
value,
onSubmit,
helpInfo,
maxLength,
type,
} = props;
return (
<div className="textfield">
<Form.Item
label={label}
hasFeedback
validateStatus="error"
help="Should be combination of numbers & alphabets"
>
<Input placeholder="Owncast" value={value} />
</Form.Item>
</div>
);
}