From 0f390ab493abdd133ec968a78a69135b6f9fc13b Mon Sep 17 00:00:00 2001 From: gianantoniopini <63844628+gianantoniopini@users.noreply.github.com> Date: Tue, 10 Nov 2020 14:01:16 +0100 Subject: [PATCH] Issue #314: Updated Celebi, Gengar, Glalie and Pikachu templates to include new birthDate field; deleted ContactE block as it is no longer used in the Celebi template. --- src/templates/Celebi.js | 14 +++- src/templates/Gengar.js | 6 +- src/templates/Glalie.js | 7 +- src/templates/Pikachu.js | 2 + src/templates/blocks/BirthDate/BirthDateC.js | 27 ++++++++ src/templates/blocks/Contact/ContactE.js | 72 -------------------- 6 files changed, 52 insertions(+), 76 deletions(-) create mode 100644 src/templates/blocks/BirthDate/BirthDateC.js delete mode 100644 src/templates/blocks/Contact/ContactE.js diff --git a/src/templates/Celebi.js b/src/templates/Celebi.js index 285af3f5..56275fd3 100644 --- a/src/templates/Celebi.js +++ b/src/templates/Celebi.js @@ -1,9 +1,10 @@ import React from 'react'; +import { useTranslation } from 'react-i18next'; import PageContext from '../contexts/PageContext'; import { hexToRgb } from '../utils'; import AwardsA from './blocks/Awards/AwardsA'; import CertificationsA from './blocks/Certifications/CertificationsA'; -import ContactE from './blocks/Contact/ContactE'; +import ContactC from './blocks/Contact/ContactC'; import EducationA from './blocks/Education/EducationA'; import HeadingE from './blocks/Heading/HeadingE'; import HobbiesA from './blocks/Hobbies/HobbiesA'; @@ -13,6 +14,7 @@ import ProjectsA from './blocks/Projects/ProjectsA'; import ReferencesA from './blocks/References/ReferencesA'; import SkillsA from './blocks/Skills/SkillsA'; import WorkA from './blocks/Work/WorkA'; +import BirthDateA from './blocks/BirthDate/BirthDateA' const Blocks = { objective: ObjectiveA, @@ -30,6 +32,7 @@ const Blocks = { const Celebi = ({ data }) => { const layout = data.metadata.layout.celebi; const { r, g, b } = hexToRgb(data.metadata.colors.primary) || {}; + const { t } = useTranslation(); const styles = { header: { @@ -94,8 +97,15 @@ const Celebi = ({ data }) => {
+
- +
+ {t('builder.sections.profile')} +
+ + +
+
{layout[0] && layout[0].map((x) => { diff --git a/src/templates/Gengar.js b/src/templates/Gengar.js index 07a65294..41f828e2 100644 --- a/src/templates/Gengar.js +++ b/src/templates/Gengar.js @@ -13,6 +13,7 @@ import ProjectsA from './blocks/Projects/ProjectsA'; import ReferencesB from './blocks/References/ReferencesB'; import SkillsA from './blocks/Skills/SkillsA'; import WorkA from './blocks/Work/WorkA'; +import BirthDateC from './blocks/BirthDate/BirthDateC' const Blocks = { objective: ObjectiveA, @@ -84,7 +85,10 @@ const Gengar = ({ data }) => { style={{ borderColor: data.metadata.colors.background }} /> - +
+ + +
{ >
- + +
+ + +
{layout[0] && layout[0].map((x) => { diff --git a/src/templates/Pikachu.js b/src/templates/Pikachu.js index 5b30a68e..6cf75739 100644 --- a/src/templates/Pikachu.js +++ b/src/templates/Pikachu.js @@ -12,6 +12,7 @@ import ProjectsA from './blocks/Projects/ProjectsA'; import ReferencesA from './blocks/References/ReferencesA'; import SkillsA from './blocks/Skills/SkillsA'; import WorkA from './blocks/Work/WorkA'; +import BirthDateB from './blocks/BirthDate/BirthDateB' const Blocks = { work: WorkA, @@ -89,6 +90,7 @@ const Pikachu = ({ data }) => {
+ {layout[0] && diff --git a/src/templates/blocks/BirthDate/BirthDateC.js b/src/templates/blocks/BirthDate/BirthDateC.js new file mode 100644 index 00000000..8c8c04e9 --- /dev/null +++ b/src/templates/blocks/BirthDate/BirthDateC.js @@ -0,0 +1,27 @@ +import React, { memo, useContext } from 'react'; +import PageContext from '../../../contexts/PageContext'; +import { get } from 'lodash'; +import Icons from '../Icons'; +import { formatDate } from '../../../utils'; + +const BirthDateC = () => { + const { data } = useContext(PageContext); + const Icon = get(Icons, "birthdaycake"); + + if (data.profile.birthDate) { + return ( +
+ + {formatDate({ date: data.profile.birthDate, language: data.metadata.language, includeDay: true })} +
+ ); + } + + return null; +} + +export default memo(BirthDateC); \ No newline at end of file diff --git a/src/templates/blocks/Contact/ContactE.js b/src/templates/blocks/Contact/ContactE.js deleted file mode 100644 index 28413fea..00000000 --- a/src/templates/blocks/Contact/ContactE.js +++ /dev/null @@ -1,72 +0,0 @@ -import React, { memo, useContext } from 'react'; -import { useTranslation } from 'react-i18next'; -import PageContext from '../../../contexts/PageContext'; -import { safetyCheck } from '../../../utils'; - -const ContactItem = ({ value, label, link }) => { - return value ? ( -
-
{label}
- {link ? ( - - {value} - - ) : ( - {value} - )} -
- ) : null; -}; - -const ContactE = () => { - const { t } = useTranslation(); - const { data, heading: Heading } = useContext(PageContext); - - return ( -
- {t('builder.sections.profile')} -
-
-
- {t('shared.forms.address')} -
-
- {data.profile.address.line1} - {data.profile.address.line2} - - {data.profile.address.city} {data.profile.address.pincode} - -
-
- - - - - - {safetyCheck(data.social) && - data.social.items.map((x) => ( - - ))} -
-
- ); -}; - -export default memo(ContactE);