diff --git a/src/components/App/App.js b/src/components/App/App.js index 6fea70b8..bae1ab7d 100644 --- a/src/components/App/App.js +++ b/src/components/App/App.js @@ -5,23 +5,36 @@ import Onyx from '../../templates/onyx'; import LeftSidebar from '../LeftSidebar/LeftSidebar'; import RightSidebar from '../RightSidebar/RightSidebar'; import AppContext from '../../context/AppContext'; +import Pikachu from '../../templates/pikachu/Pikachu'; const App = () => { const context = useContext(AppContext); - const { dispatch } = context; + const { state, dispatch } = context; + const { theme } = state; useEffect(() => { - const state = JSON.parse(localStorage.getItem('state')); - dispatch({ type: 'import_data', payload: state }); + const storedState = JSON.parse(localStorage.getItem('state')); + dispatch({ type: 'import_data', payload: storedState }); }, [dispatch]); + const renderTemplate = () => { + switch (theme.layout) { + case 'Onyx': + return ; + case 'Pikachu': + return ; + default: + return null; + } + }; + return (
- + {renderTemplate()}
diff --git a/src/components/LeftSidebar/tabs/Skills.js b/src/components/LeftSidebar/tabs/Skills.js index eb26fc84..39aea3ea 100644 --- a/src/components/LeftSidebar/tabs/Skills.js +++ b/src/components/LeftSidebar/tabs/Skills.js @@ -53,7 +53,6 @@ const AddItem = ({ dispatch }) => { }); setItem(''); - setOpen(false); }; return ( diff --git a/src/components/RightSidebar/RightSidebar.js b/src/components/RightSidebar/RightSidebar.js index 4b1ef163..f8e209da 100644 --- a/src/components/RightSidebar/RightSidebar.js +++ b/src/components/RightSidebar/RightSidebar.js @@ -30,7 +30,7 @@ const RightSidebar = () => { const renderTabs = () => { switch (currentTab) { case 'Layout': - return ; + return ; case 'Colors': return ; case 'Fonts': diff --git a/src/components/RightSidebar/tabs/Colors.js b/src/components/RightSidebar/tabs/Colors.js index 3d2fcb3f..7d79b663 100644 --- a/src/components/RightSidebar/tabs/Colors.js +++ b/src/components/RightSidebar/tabs/Colors.js @@ -56,7 +56,7 @@ const ColorsTab = ({ theme, onChange }) => {
-
+ {/*
{ onChange={v => onChange('theme.colors.background', v)} />
-
+
*/}
{ +const LayoutTab = ({ theme, onChange }) => { return (
{layouts.map(x => ( -
+
onChange('theme.layout', x.name)}> {x.name} diff --git a/src/context/AppContext.js b/src/context/AppContext.js index 05ee2379..bf04b3cb 100644 --- a/src/context/AppContext.js +++ b/src/context/AppContext.js @@ -67,9 +67,9 @@ const initialState = { family: '', }, colors: { - background: '', - primary: '', - accent: '', + background: '#ffffff', + primary: '#212121', + accent: '#f44336', }, }, }; @@ -100,6 +100,7 @@ const reducer = (state, { type, payload }) => { localStorage.setItem('state', JSON.stringify(state)); return state; case 'import_data': + if (payload === null) return initialState; return { ...state, data: payload.data, diff --git a/src/index.css b/src/index.css index a6ccdc99..6672bc21 100644 --- a/src/index.css +++ b/src/index.css @@ -57,7 +57,6 @@ body { body, body * { -webkit-print-color-adjust: exact; - background-color: white; visibility: hidden; } @@ -67,6 +66,7 @@ body { } #page { + background-color: white; width: 21cm; height: 29.7cm; margin: 0; diff --git a/src/templates/onyx/preview.png b/src/templates/onyx/preview.png index 6f86a789..9802cd6c 100644 Binary files a/src/templates/onyx/preview.png and b/src/templates/onyx/preview.png differ diff --git a/src/templates/pikachu/Pikachu.js b/src/templates/pikachu/Pikachu.js new file mode 100644 index 00000000..e92e5b06 --- /dev/null +++ b/src/templates/pikachu/Pikachu.js @@ -0,0 +1,184 @@ +import React, { useContext } from 'react'; +import AppContext from '../../context/AppContext'; + +const Pikachu = () => { + const context = useContext(AppContext); + const { state } = context; + const { data, theme } = state; + + const Photo = () => ; + + const Header = () => ( +
+
+

+ {data.profile.firstName} {data.profile.lastName} +

+
{data.profile.subtitle}
+ +
+ +
{data.objective.body}
+
+
+ ); + + const ContactItem = ({ icon, value }) => + value && ( +
+ + {icon} + + {value} +
+ ); + + const SectionHeading = ({ title }) => ( +
+ {title} +
+ ); + + const SkillItem = x => ( + + {x} + + ); + + const ExtraItem = x => ( +
+
{x.key}
+
{x.value}
+
+ ); + + const WorkItem = x => ( +
+
+
+
{x.title}
+

{x.role}

+
+ + ({x.start} - {x.end}) + +
+

{x.description}

+
+ ); + + const EducationItem = x => ( +
+
+
+
{x.name}
+

{x.major}

+
+
+ + {x.grade} + + + ({x.start} - {x.end}) + +
+
+

{x.description}

+
+ ); + + const AwardCertificationItem = x => ( +
+
{x.title}
+

{x.subtitle}

+
+ ); + + return ( +
+
+
+ +
+ +
+
+
+ +
+
+ + + + +
+ + {data.skills.enable && ( +
+ +
{data.skills.items.map(SkillItem)}
+
+ )} + + {data.extras.enable && ( +
+ +
{data.extras.items.map(ExtraItem)}
+
+ )} +
+ +
+ {data.work.enable && ( +
+ +
{data.work.items.map(WorkItem)}
+
+ )} + + {data.education.enable && ( +
+ +
{data.education.items.map(EducationItem)}
+
+ )} + + {data.awards.enable && ( +
+ +
+ {data.awards.items.map(AwardCertificationItem)} +
+
+ )} + + {data.certifications.enable && ( +
+ +
+ {data.certifications.items.map(AwardCertificationItem)} +
+
+ )} +
+
+
+ ); +}; + +export default Pikachu; diff --git a/src/templates/pikachu/index.js b/src/templates/pikachu/index.js new file mode 100644 index 00000000..1befc86f --- /dev/null +++ b/src/templates/pikachu/index.js @@ -0,0 +1,5 @@ +import Pikachu from './Pikachu'; +import image from './preview.png'; + +export const Image = image; +export default Pikachu; diff --git a/src/templates/pikachu/preview.png b/src/templates/pikachu/preview.png new file mode 100644 index 00000000..34b10c79 Binary files /dev/null and b/src/templates/pikachu/preview.png differ