- implement gengar template

This commit is contained in:
Amruth Pillai
2020-07-12 19:31:22 +05:30
parent 5ccc360345
commit 41e708e302
24 changed files with 677 additions and 550 deletions

View File

@ -2,7 +2,9 @@ import React, { memo } from 'react';
import { Helmet } from 'react-helmet';
import { useSelector } from '../../../contexts/ResumeContext';
import Onyx from '../../../templates/Onyx';
import Pikachu from '../../../templates/Pikachu';
import styles from './Artboard.module.css';
import Gengar from '../../../templates/Gengar';
const Artboard = () => {
const state = useSelector();
@ -18,6 +20,8 @@ const Artboard = () => {
<div id="artboard" className={styles.container}>
{template === 'onyx' && <Onyx data={state} />}
{template === 'pikachu' && <Pikachu data={state} />}
{template === 'gengar' && <Gengar data={state} />}
</div>
</div>
);

View File

@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { memo, useState } from 'react';
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
import { useDispatch, useSelector } from '../../../../contexts/ResumeContext';
import { move, reorder } from '../../../../utils';
@ -9,7 +9,8 @@ import styles from './Layout.module.css';
const Layout = () => {
const [resetLayoutText, setResetLayoutText] = useState('Reset Layout');
const blocks = useSelector('metadata.layout');
const template = useSelector('metadata.template');
const blocks = useSelector(`metadata.layout.${template}`, [[]]);
const dispatch = useDispatch();
const onDragEnd = (result) => {
@ -28,7 +29,7 @@ const Layout = () => {
dispatch({
type: 'on_input',
payload: {
path: 'metadata.layout',
path: `metadata.layout.${template}`,
value: newState,
},
});
@ -40,7 +41,7 @@ const Layout = () => {
dispatch({
type: 'on_input',
payload: {
path: 'metadata.layout',
path: `metadata.layout.${template}`,
value: newState,
},
});
@ -110,4 +111,4 @@ const Layout = () => {
);
};
export default Layout;
export default memo(Layout);