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

@@ -3,3 +3,5 @@
export const DEFAULT_NAME = 'Owncast User'; export const DEFAULT_NAME = 'Owncast User';
export const DEFAULT_TITLE = 'Owncast Server'; export const DEFAULT_TITLE = 'Owncast Server';
export const DEFAULT_SUMMARY = ''; export const DEFAULT_SUMMARY = '';
export const TEXT_MAXLENGTH = 255;

View File

@@ -1,5 +1,5 @@
/* /*
- auto saves ,ajax call - auto saves ,ajax call (submit when blur or onEnter)
- set default text - set default text
- show error state/confirm states - show error state/confirm states
- show info - show info
@@ -16,10 +16,49 @@ update vals to state, andthru api.
*/ */
import React, { useContext } from 'react'; import React from 'react';
import { ServerStatusContext } from '../../../utils/server-status-context'; 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 // // do i need this?
<Input placeholder="Owncast" value={name} /> // 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>
);
}

View File

@@ -1,5 +1,7 @@
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { Typography, Input } from 'antd'; import { Typography, Input, Form } from 'antd';
import TextField from './form-textfield';
import { ServerStatusContext } from '../../../utils/server-status-context'; import { ServerStatusContext } from '../../../utils/server-status-context';
@@ -18,16 +20,18 @@ export default function PublicFacingDetails() {
<> <>
<Title level={2}>Edit your public facing instance details</Title> <Title level={2}>Edit your public facing instance details</Title>
<div className="config-public-details-container"> <div className="config-public-details-container">
<div className="text-fields" role="form"> <div className="text-fields">
Server Name <Form name="text-fields" labelCol={{ span: 8 }} wrapperCol={{ span: 16 }}>
<Input placeholder="Owncast" value={name} /> <TextField
label="name"
value={name}
/>
</Form>
</div> </div>
<div className="misc-optionals"> <div className="misc-optionals">
add social handles add social handles comp
<br/> <br/>
add tags add tags comp
</div> </div>
</div> </div>