aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/projets
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-03 19:36:03 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit0e60743d140aff66eca6df712f653ee20f5d4ef3 (patch)
treee72bc8bf2314a26ba3c8e27e571d72e203bbf0c8 /src/pages/projets
parenta3fb0aa94717aafae897ac293488c43a099c0b2b (diff)
refactor(components): rewrite SocialLink component
* replace default label with a label prop * rename name prop to icon prop
Diffstat (limited to 'src/pages/projets')
-rw-r--r--src/pages/projets/[slug].tsx37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/pages/projets/[slug].tsx b/src/pages/projets/[slug].tsx
index 89891b3..ee86c7b 100644
--- a/src/pages/projets/[slug].tsx
+++ b/src/pages/projets/[slug].tsx
@@ -19,7 +19,6 @@ import {
type ResponsiveImageProps,
Sharing,
SocialLink,
- type SocialWebsite,
Spinner,
type MetaData,
Heading,
@@ -30,7 +29,6 @@ import styles from '../../styles/pages/project.module.scss';
import type { NextPageWithLayout, ProjectPreview, Repos } from '../../types';
import { ROUTES } from '../../utils/constants';
import {
- capitalize,
getSchemaJson,
getSinglePageSchema,
getWebPageSchema,
@@ -182,13 +180,34 @@ const ProjectPage: NextPageWithLayout<ProjectPageProps> = ({ project }) => {
*/
const getReposLinks = (repositories: Repos): JSX.Element[] => {
const links = [];
-
- for (const [name, url] of Object.entries(repositories)) {
- const socialWebsite = capitalize(name) as SocialWebsite;
- const socialUrl = `https://${name}.com/${url}`;
-
- links.push(<SocialLink name={socialWebsite} url={socialUrl} />);
- }
+ const githubLabel = intl.formatMessage({
+ defaultMessage: 'Github profile',
+ description: 'ProjectsPage: Github profile link',
+ id: 'Nx8Jo5',
+ });
+ const gitlabLabel = intl.formatMessage({
+ defaultMessage: 'Gitlab profile',
+ description: 'ProjectsPage: Gitlab profile link',
+ id: 'sECHDg',
+ });
+
+ if (repositories.github)
+ links.push(
+ <SocialLink
+ icon="Github"
+ label={githubLabel}
+ url={repositories.github}
+ />
+ );
+
+ if (repositories.gitlab)
+ links.push(
+ <SocialLink
+ icon="Gitlab"
+ label={gitlabLabel}
+ url={repositories.gitlab}
+ />
+ );
return links;
};