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

NodeLayout

This commit is contained in:
muerwre 2019-08-25 16:10:46 +07:00
parent 684a4f4474
commit b154277de8
23 changed files with 332 additions and 65 deletions

View file

@ -1,8 +1,15 @@
import { IBlock, INode } from '../types';
import { IBlock, INode, ValueOf } from '../types';
import { NodeImageBlock } from '~/components/node/NodeImageBlock';
import { NodeImageBlockPlaceholder } from '~/components/node/NodeImageBlockPlaceholder';
import { ReactElement, FC } from 'react';
const prefix = 'NODE.';
export const NODE_ACTIONS = {
SAVE: 'NODE.SAVE',
SET_SAVE_ERRORS: 'NODE.SET_SAVE_ERRORS',
SAVE: `${prefix}NODE.SAVE`,
LOAD_NODE: `${prefix}LOAD_NODE`,
SET_SAVE_ERRORS: `${prefix}NODE.SET_SAVE_ERRORS`,
SET_LOADING: `${prefix}NODE.SET_LOADING`,
};
export const EMPTY_BLOCK: IBlock = {
@ -32,3 +39,22 @@ export const EMPTY_NODE: INode = {
},
},
};
export const NODE_TYPES = {
IMAGE: 'image',
AUDIO: 'audio',
VIDEO: 'video',
TEXT: 'text',
};
type INodeComponents = Record<
ValueOf<typeof NODE_TYPES>,
Record<'component' | 'placeholder', FC<{ node: INode }>>
>;
export const NODE_COMPONENTS: INodeComponents = {
[NODE_TYPES.IMAGE]: {
component: NodeImageBlock,
placeholder: NodeImageBlockPlaceholder,
},
};