1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36: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 * as styles from './styles.scss';
import path from 'ramda/es/path';
import { Icon } from '~/components/input/Icon';
import { flowSetCellView } from '~/redux/flow/actions';
@ -18,7 +17,7 @@ interface IProps {
}
const Cell: FC<IProps> = ({
node: { id, title, thumbnail, type, blocks, flow },
node: { id, title, thumbnail, type, flow, description },
can_edit,
onSelect,
onChangeCellView,
@ -29,12 +28,12 @@ const Cell: FC<IProps> = ({
setIsLoaded(true);
}, [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 show_description = flow && !flow.show_description;
const show_description = !(flow && flow.show_description);
const display = (flow && flow.display) || 'single';
onChangeCellView(id, { show_description, display });
}, [id, flow, onChangeCellView]);
@ -70,7 +69,7 @@ const Cell: FC<IProps> = ({
</div>
<div className={styles.menu_content}>
<Icon icon="cell-single" onClick={toggleViewDescription} />
<Icon icon="text" onClick={toggleViewDescription} />
<div className={styles.menu_sep} />
<Icon icon="cell-single" onClick={setViewSingle} />
<Icon icon="cell-double-h" onClick={setViewHorizontal} />

View file

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