diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-29 23:25:26 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-29 23:25:26 +0100 |
| commit | f49dfba86b9ac745ddc374ee0f02f03d7e81d872 (patch) | |
| tree | ea647377926391e9391759d95f95824515b286ca /src/components/Widgets/SocialMedia | |
| parent | b2686521cf2ca6bb0b5c5164de72d3d39d5c510e (diff) | |
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.
Diffstat (limited to 'src/components/Widgets/SocialMedia')
| -rw-r--r-- | src/components/Widgets/SocialMedia/SocialMedia.tsx | 41 |
1 files changed, 39 insertions, 2 deletions
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) ? ( <li key={website.id}> <a href={website.url} className={styles.link}> |
