From 04603e7bd3a2667145938a298685625dd5e15d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20Dore=CC=81?= Date: Tue, 11 Oct 2022 22:48:43 +0200 Subject: [PATCH] Added type and new styling for showcases --- gitprofile.config.js | 13 +-- src/components/GitProfile.jsx | 11 ++- src/components/showcase/index.jsx | 132 +++++++++++++++--------------- types/index.d.ts | 12 +++ 4 files changed, 92 insertions(+), 76 deletions(-) diff --git a/gitprofile.config.js b/gitprofile.config.js index 772bf6a..2d0b414 100644 --- a/gitprofile.config.js +++ b/gitprofile.config.js @@ -86,16 +86,17 @@ const config = { { 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', + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris. \ + Donec euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris. Donec euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris.', + link: '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', + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris. \ + Donec euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris. Donec euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, eget aliquam nisl nunc vel mauris.', + imageUrl: 'https://via.placeholder.com/250x250', + link: 'https://example.com', }, ], // Display blog posts from your medium or dev account. (Optional) diff --git a/src/components/GitProfile.jsx b/src/components/GitProfile.jsx index 7da7a25..90d06cb 100644 --- a/src/components/GitProfile.jsx +++ b/src/components/GitProfile.jsx @@ -197,18 +197,17 @@ const GitProfile = ({ config }) => {
- + { +const Showcase = ({ cases, loading, googleAnalytics }) => { 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' })} -
+ return [ +
+
+
+
+ +
+ {skeleton({ width: 'w-32', height: 'h-8' })} +
+
-
-
- - {skeleton({ width: 'w-12', height: 'h-4' })} - - - {skeleton({ width: 'w-12', height: 'h-4' })} - -
-
- - {skeleton({ width: 'w-12', height: 'h-4' })} - -
+
+ {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', + action: 'Click Showcase', params: { - project: item.name, + post: item.name, }, }); } @@ -73,29 +69,38 @@ const Showcase = ({ cases, loading, github, googleAnalytics }) => { console.error(error); } - window?.open(item.html_url, '_blank'); + window?.open(item.link, '_blank'); }} > -
-
-
- - -
- {item.name} -
-
-
-
- {item?.image_url && ( -
- {item.name} +
+
+ {item.imageUrl && ( +
+
+ +
+
+ )} +
+
+
+

+
+ {item.name} +
+

+

+ {item.description} +

- )} -
-

- {item.description} -

@@ -139,7 +144,6 @@ const Showcase = ({ cases, loading, github, googleAnalytics }) => { Showcase.propTypes = { cases: PropTypes.array, loading: PropTypes.bool.isRequired, - github: PropTypes.object.isRequired, googleAnalytics: PropTypes.object, }; diff --git a/types/index.d.ts b/types/index.d.ts index 6278739..7354923 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -221,6 +221,13 @@ export interface Certifications { link?: string; } +export interface Showcase { + name?: string; + description?: string; + imageUrl?: string; + link?: string; +} + export interface Education { institution?: string; degree?: string; @@ -257,6 +264,11 @@ export interface Config { * Experience list */ experiences?: Array; + + /** + * Showcase list + */ + showcases?: Array; /** * Certifications list