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

fixed toggling text view

This commit is contained in:
Fedor Katurov 2019-10-23 15:11:20 +07:00
parent 9fc1d3b918
commit 7254a448c1
2 changed files with 8 additions and 13 deletions

View file

@ -4,7 +4,6 @@ import { getURL } from '~/utils/dom';
import classNames from 'classnames'; import classNames from 'classnames';
import * as styles from './styles.scss'; import * as styles from './styles.scss';
import path from 'ramda/es/path';
import { Icon } from '~/components/input/Icon'; import { Icon } from '~/components/input/Icon';
import { flowSetCellView } from '~/redux/flow/actions'; import { flowSetCellView } from '~/redux/flow/actions';
@ -18,7 +17,7 @@ interface IProps {
} }
const Cell: FC<IProps> = ({ const Cell: FC<IProps> = ({
node: { id, title, thumbnail, type, blocks, flow }, node: { id, title, thumbnail, type, flow, description },
can_edit, can_edit,
onSelect, onSelect,
onChangeCellView, onChangeCellView,
@ -29,12 +28,12 @@ const Cell: FC<IProps> = ({
setIsLoaded(true); setIsLoaded(true);
}, [setIsLoaded]); }, [setIsLoaded]);
const onClick = useCallback(() => onSelect(id, type), [onSelect, id]); const onClick = useCallback(() => onSelect(id, type), [onSelect, id, type]);
const text = path([0, 'text'], blocks); const text = (((flow && !!flow.show_description) || type === 'text') && description) || null;
const toggleViewDescription = useCallback(() => { const toggleViewDescription = useCallback(() => {
const show_description = flow && !flow.show_description; const show_description = !(flow && flow.show_description);
const display = (flow && flow.display) || 'single'; const display = (flow && flow.display) || 'single';
onChangeCellView(id, { show_description, display }); onChangeCellView(id, { show_description, display });
}, [id, flow, onChangeCellView]); }, [id, flow, onChangeCellView]);
@ -70,7 +69,7 @@ const Cell: FC<IProps> = ({
</div> </div>
<div className={styles.menu_content}> <div className={styles.menu_content}>
<Icon icon="cell-single" onClick={toggleViewDescription} /> <Icon icon="text" onClick={toggleViewDescription} />
<div className={styles.menu_sep} /> <div className={styles.menu_sep} />
<Icon icon="cell-single" onClick={setViewSingle} /> <Icon icon="cell-single" onClick={setViewSingle} />
<Icon icon="cell-double-h" onClick={setViewHorizontal} /> <Icon icon="cell-double-h" onClick={setViewHorizontal} />

View file

@ -138,22 +138,18 @@
.menu { .menu {
position: absolute; position: absolute;
top: 0; top: -$gap;
right: 0; right: -$gap;
// height: 100%;
// width: 80px;
z-index: 4; z-index: 4;
border-radius: $radius; border-radius: $radius;
// opacity: 0;
pointer-events: none; pointer-events: none;
touch-action: none; touch-action: none;
transition: opacity 0.5s; transition: opacity 0.5s;
box-sizing: border-box; box-sizing: border-box;
// display: none;
// padding: $gap;
display: flex; display: flex;
align-items: stretch; align-items: stretch;
justify-content: center; justify-content: center;
padding: $gap;
&:hover { &:hover {
opacity: 1; opacity: 1;