refract make reusable components

This commit is contained in:
cv
2021-04-10 22:21:01 +02:00
parent e51f3e6cd5
commit 54d19d729b
15 changed files with 311 additions and 160 deletions
+22
View File
@@ -0,0 +1,22 @@
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;
return (
<div style={{ display: 'block' }}>
<span className={props.underlined ? style.titleUnderlined : style.title}>
{label}
</span>
<Editable
onSubmit={(v) => handleSubmit(v)}
defaultValue={defaultValue}
placeholder={placeholder}
style={{ display: 'inline' }}
>
<EditablePreview />
<EditableInput style={{ width: '13em', minWidth: '13em' }} />
</Editable>
</div>
);
}