From f49dfba86b9ac745ddc374ee0f02f03d7e81d872 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sat, 29 Jan 2022 23:25:26 +0100 Subject: refactor(widgets): move social media websites from config to widget I only use this config inside the SocialMedia widget so it makes more sense to gather them. In addition I can translate the website names if needed. --- src/components/Widgets/SocialMedia/SocialMedia.tsx | 41 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'src/components/Widgets/SocialMedia/SocialMedia.tsx') diff --git a/src/components/Widgets/SocialMedia/SocialMedia.tsx b/src/components/Widgets/SocialMedia/SocialMedia.tsx index e4151fc..f96d10f 100644 --- a/src/components/Widgets/SocialMedia/SocialMedia.tsx +++ b/src/components/Widgets/SocialMedia/SocialMedia.tsx @@ -1,10 +1,10 @@ -import { socialWebsites } from '@config/social-media'; import GithubIcon from '@assets/images/social-media/github.svg'; import GitlabIcon from '@assets/images/social-media/gitlab.svg'; import LinkedInIcon from '@assets/images/social-media/linkedin.svg'; import TwitterIcon from '@assets/images/social-media/twitter.svg'; import styles from './SocialMedia.module.scss'; import { ExpandableWidget } from '@components/WidgetParts'; +import { useIntl } from 'react-intl'; const SocialMedia = ({ title, @@ -19,6 +19,43 @@ const SocialMedia = ({ linkedin?: boolean; twitter?: boolean; }) => { + const intl = useIntl(); + + const websites = [ + { + id: 'github', + name: intl.formatMessage({ + defaultMessage: 'Github', + description: 'SocialMedia: Github', + }), + url: 'https://github.com/ArmandPhilippot', + }, + { + id: 'gitlab', + name: intl.formatMessage({ + defaultMessage: 'Gitlab', + description: 'SocialMedia: Gitlab', + }), + url: 'https://gitlab.com/ArmandPhilippot', + }, + { + id: 'linkedin', + name: intl.formatMessage({ + defaultMessage: 'LinkedIn', + description: 'SocialMedia: LinkedIn', + }), + url: 'https://www.linkedin.com/in/armandphilippot', + }, + { + id: 'twitter', + name: intl.formatMessage({ + defaultMessage: 'Twitter', + description: 'SocialMedia: Twitter', + }), + url: 'https://twitter.com/ArmandPhilippot', + }, + ]; + const getIcon = (id: string) => { switch (id) { case 'github': @@ -49,7 +86,7 @@ const SocialMedia = ({ } }; - const items = socialWebsites.map((website) => { + const items = websites.map((website) => { return shouldDisplayLink(website.id) ? (
  • -- cgit v1.2.3