cleanup + small refract

- websockets
- event api
This commit is contained in:
cv
2021-04-11 19:17:54 +02:00
parent dee0ff1a5c
commit 964bdf0d2a
12 changed files with 145 additions and 149 deletions
+12 -4
View File
@@ -2,9 +2,17 @@ import { Editable, EditableInput, EditablePreview } from '@chakra-ui/editable';
import style from './EditableText.module.css';
export default function EditableText(props) {
const { label, defaultValue, placeholder, handleSubmit } = props;
const { label, defaultValue, placeholder, submitHandler } = props;
const handleSubmit = (submitedVal) => {
// No need to update if it hasnt changed
if (submitedVal === defaultValue) return;
submitHandler(submitedVal);
};
return (
<div style={{ display: 'block' }}>
<div className={style.block}>
<span className={props.underlined ? style.titleUnderlined : style.title}>
{label}
</span>
@@ -12,10 +20,10 @@ export default function EditableText(props) {
onSubmit={(v) => handleSubmit(v)}
defaultValue={defaultValue}
placeholder={placeholder}
style={{ display: 'inline' }}
className={style.inline}
>
<EditablePreview />
<EditableInput style={{ width: '13em', minWidth: '13em' }} />
<EditableInput className={style.editable13} />
</Editable>
</div>
);