From 422e0ba12fbf3744768dde6e75d523a803299008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20Dore=CC=81?= Date: Mon, 10 Oct 2022 14:48:00 +0200 Subject: [PATCH] Clean commit for showcases with image possibility --- gitprofile.config.js | 16 ++++ src/components/GitProfile.jsx | 8 ++ src/components/showcase/index.jsx | 146 ++++++++++++++++++++++++++++++ src/helpers/utils.jsx | 1 + 4 files changed, 171 insertions(+) create mode 100644 src/components/showcase/index.jsx diff --git a/gitprofile.config.js b/gitprofile.config.js index 4e1afc7..772bf6a 100644 --- a/gitprofile.config.js +++ b/gitprofile.config.js @@ -82,6 +82,22 @@ const config = { to: '2014', }, ], + showcases: [ + { + name: 'Website name 1', + description: + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris.', + // image_url: 'https://via.placeholder.com/250x250', + html_url: 'https://example.com', + }, + { + name: 'Website name 2', + description: + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris.', + image_url: 'https://via.placeholder.com/250x250', + html_url: 'https://example.com', + }, + ], // Display blog posts from your medium or dev account. (Optional) blog: { source: 'dev', // medium | dev diff --git a/src/components/GitProfile.jsx b/src/components/GitProfile.jsx index 95d9843..7da7a25 100644 --- a/src/components/GitProfile.jsx +++ b/src/components/GitProfile.jsx @@ -9,6 +9,7 @@ import Skill from './skill'; import Experience from './experience'; import Certification from './certification'; import Education from './education'; +import Showcase from './showcase'; import Project from './project'; import Blog from './blog'; import { @@ -196,6 +197,12 @@ const GitProfile = ({ config }) => {
+ { + const renderSkeleton = () => { + let array = []; + for (let index = 0; index < github.limit; index++) { + array.push( +
+
+
+
+ +
+ {skeleton({ width: 'w-32', height: 'h-8' })} +
+
+
+
+ {skeleton({ + width: 'w-full', + height: 'h-4', + className: 'mb-2', + })} + {skeleton({ width: 'w-full', height: 'h-4' })} +
+
+
+
+ + {skeleton({ width: 'w-12', height: 'h-4' })} + + + {skeleton({ width: 'w-12', height: 'h-4' })} + +
+
+ + {skeleton({ width: 'w-12', height: 'h-4' })} + +
+
+
+
+ ); + } + + return array; + }; + + const renderShowcases = () => { + return cases.map((item, index) => ( + { + e.preventDefault(); + + try { + if (googleAnalytics?.id) { + ga.event({ + action: 'Click showcase', + params: { + project: item.name, + }, + }); + } + } catch (error) { + console.error(error); + } + + window?.open(item.html_url, '_blank'); + }} + > +
+
+
+ + +
+ {item.name} +
+
+
+
+ {item?.image_url && ( +
+ {item.name} +
+ )} +
+

+ {item.description} +

+
+
+
+
+
+ )); + }; + + return ( + +
+
+
+
+
+
+
+ {loading ? ( + skeleton({ width: 'w-28', height: 'h-8' }) + ) : ( + + My Showcases + + )} +
+
+
+
+ {loading || !cases ? renderSkeleton() : renderShowcases()} +
+
+
+
+
+
+
+
+ ); +}; + +Showcase.propTypes = { + cases: PropTypes.array, + loading: PropTypes.bool.isRequired, + github: PropTypes.object.isRequired, + googleAnalytics: PropTypes.object, +}; + +export default Showcase; diff --git a/src/helpers/utils.jsx b/src/helpers/utils.jsx index e4fa356..838a1ef 100644 --- a/src/helpers/utils.jsx +++ b/src/helpers/utils.jsx @@ -162,6 +162,7 @@ export const sanitizeConfig = (config) => { fileUrl: config?.resume?.fileUrl || '', }, skills: config?.skills || [], + showcases: config?.showcases || [], experiences: config?.experiences || [], certifications: config?.certifications || [], education: config?.education || [],