From 30d567d853fbd2e0268d6fa24bb27446c35fd4f7 Mon Sep 17 00:00:00 2001 From: mupsys <1337sword@protonmail.com> Date: Sun, 9 Jan 2022 23:03:35 -0700 Subject: [PATCH] Added new ContactE without the address block and added it to the Onyx template (removes the duplicate address in that template.) Signed-off-by: mupsys <1337sword@protonmail.com> --- src/templates/Onyx.js | 2 +- src/templates/blocks/Contact/ContactE.js | 75 ++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/templates/blocks/Contact/ContactE.js diff --git a/src/templates/Onyx.js b/src/templates/Onyx.js index 4cd96bae9..b0f778dd6 100644 --- a/src/templates/Onyx.js +++ b/src/templates/Onyx.js @@ -3,7 +3,7 @@ import React, { memo } from 'react'; import { hasAddress } from '../utils'; import AwardsA from './blocks/Awards/AwardsA'; import CertificationsA from './blocks/Certifications/CertificationsA'; -import Contact from './blocks/Contact/ContactA'; +import Contact from './blocks/Contact/ContactE'; import EducationA from './blocks/Education/EducationA'; import HeadingA from './blocks/Heading/HeadingA'; import HobbiesA from './blocks/Hobbies/HobbiesA'; diff --git a/src/templates/blocks/Contact/ContactE.js b/src/templates/blocks/Contact/ContactE.js new file mode 100644 index 000000000..5c10bd757 --- /dev/null +++ b/src/templates/blocks/Contact/ContactE.js @@ -0,0 +1,75 @@ +import { FaCaretRight } from 'react-icons/fa'; +import { get } from 'lodash'; +import { useTranslation } from 'react-i18next'; +import React, { memo, useContext } from 'react'; +import { isItemVisible, safetyCheck } from '../../../utils'; +import BirthDateB from '../BirthDate/BirthDateB'; +import Icons from '../Icons'; +import PageContext from '../../../contexts/PageContext'; + +const ContactItem = ({ value, icon, link }) => { + const { data } = useContext(PageContext); + const Icon = get(Icons, icon && icon.toLowerCase(), FaCaretRight); + + return value ? ( +
+ + {link ? ( + + {value} + + ) : ( + {value} + )} +
+ ) : null; +}; + +const ContactE = () => { + const { t } = useTranslation(); + const { data } = useContext(PageContext); + + return ( +
+ + + + + + + {safetyCheck(data.social) && + data.social.items.map( + (x) => + isItemVisible(x) && ( + + ), + )} +
+ ); +}; + +export default memo(ContactE);