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

refactored flow layout

This commit is contained in:
Fedor Katurov 2020-04-18 13:54:18 +07:00
parent 756c82c8aa
commit 02885b89d5
4 changed files with 150 additions and 78 deletions

View file

@ -1,14 +1,11 @@
import React, { FC } from 'react';
import { Cell } from '~/components/flow/Cell';
import * as styles from './styles.scss';
import { IFlowState } from '~/redux/flow/reducer';
import { INode } from '~/redux/types';
import { canEditNode } from '~/utils/node';
import { IUser } from '~/redux/auth/types';
import { flowSetCellView } from '~/redux/flow/actions';
import { FlowHero } from '../FlowHero';
import { FlowRecent } from '../FlowRecent';
type IProps = Partial<IFlowState> & {
user: Partial<IUser>;
@ -16,34 +13,16 @@ type IProps = Partial<IFlowState> & {
onChangeCellView: typeof flowSetCellView;
};
export const FlowGrid: FC<IProps> = ({
user,
nodes,
heroes,
recent,
updated,
onSelect,
onChangeCellView,
}) => (
<div>
<div className={styles.grid_test}>
<div className={styles.hero}>
<FlowHero heroes={heroes} />
</div>
<div className={styles.stamp}>
<FlowRecent recent={recent} updated={updated} />
</div>
{nodes.map(node => (
<Cell
key={node.id}
node={node}
onSelect={onSelect}
can_edit={canEditNode(node, user)}
onChangeCellView={onChangeCellView}
/>
))}
</div>
</div>
export const FlowGrid: FC<IProps> = ({ user, nodes, onSelect, onChangeCellView }) => (
<>
{nodes.map(node => (
<Cell
key={node.id}
node={node}
onSelect={onSelect}
can_edit={canEditNode(node, user)}
onChangeCellView={onChangeCellView}
/>
))}
</>
);