1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

sagas for node creation dialog

This commit is contained in:
Fedor Katurov 2019-10-16 16:22:01 +07:00
parent 265b075ddc
commit 1b6a81d27c
11 changed files with 119 additions and 22 deletions

View file

@ -0,0 +1,27 @@
import React, { FC, useCallback } from 'react';
import { INode } from '~/redux/types';
import * as styles from './styles.scss';
import { Textarea } from '~/components/input/Textarea';
import path from 'ramda/es/path';
interface IProps {
data: INode;
setData: (val: INode) => void;
}
const TextEditor: FC<IProps> = ({ data, setData }) => {
const setText = useCallback(
(text: string) => setData({ ...data, blocks: [{ type: 'text', text }] }),
[data, setData]
);
const text = (path(['blocks', 0, 'text'], data) as string) || '';
return (
<div className={styles.wrap}>
<Textarea value={text} handler={setText} minRows={6} />
</div>
);
};
export { TextEditor };

View file

@ -0,0 +1,3 @@
.wrap {
padding-bottom: 60px;
}