From 9e34239877905820ea0e982ef60780c997a778fc Mon Sep 17 00:00:00 2001 From: Nate Goldsborough Date: Tue, 1 Nov 2022 00:36:23 -0500 Subject: [PATCH] Adds a Certifications section --- gitprofile.config.js | 7 ++ src/components/GitProfile.jsx | 12 ++++ src/components/certifications/index.jsx | 93 +++++++++++++++++++++++++ src/helpers/utils.jsx | 1 + types/index.d.ts | 10 +++ 5 files changed, 123 insertions(+) create mode 100644 src/components/certifications/index.jsx diff --git a/gitprofile.config.js b/gitprofile.config.js index f9e9542..e446b05 100644 --- a/gitprofile.config.js +++ b/gitprofile.config.js @@ -59,6 +59,13 @@ const config = { companyLink: 'https://example.com', }, ], + certifications: [ + { + body: 'Certification Body Name', + name: 'My Sample Certification', + year: 'March 2022', + }, + ], education: [ { institution: 'Institution Name', diff --git a/src/components/GitProfile.jsx b/src/components/GitProfile.jsx index 4aaef5f..7640fbe 100644 --- a/src/components/GitProfile.jsx +++ b/src/components/GitProfile.jsx @@ -7,6 +7,7 @@ import AvatarCard from './avatar-card'; import Details from './details'; import Skill from './skill'; import Experience from './experience'; +import Certifications from './certifications'; import Education from './education'; import Project from './project'; import Blog from './blog'; @@ -183,6 +184,10 @@ const GitProfile = ({ config }) => { loading={loading} experiences={sanitizedConfig.experiences} /> + ( +
  • +
    +
    {year}
    +

    {name}

    +
    {body}
    +
  • +); + +const Certifications = ({ certifications, loading }) => { + const renderSkeleton = () => { + let array = []; + for (let index = 0; index < 2; index++) { + array.push( + + ); + } + + return array; + }; + + return ( + <> + {certifications?.length !== 0 && ( +
    +
    +
    +
    + {loading ? ( + skeleton({ width: 'w-32', height: 'h-8' }) + ) : ( + + Certifications + + )} +
    +
    +
    +
      + {loading ? ( + renderSkeleton() + ) : ( + + {certifications.map((certification, index) => ( + + ))} + + )} +
    +
    +
    +
    + )} + + ); +}; + +ListItem.propTypes = { + year: PropTypes.node, + name: PropTypes.node, + body: PropTypes.node, +}; + +Certifications.propTypes = { + certifications: PropTypes.array.isRequired, + loading: PropTypes.bool.isRequired, +}; + +export default Certifications; diff --git a/src/helpers/utils.jsx b/src/helpers/utils.jsx index 8476645..e4fa356 100644 --- a/src/helpers/utils.jsx +++ b/src/helpers/utils.jsx @@ -163,6 +163,7 @@ export const sanitizeConfig = (config) => { }, skills: config?.skills || [], experiences: config?.experiences || [], + certifications: config?.certifications || [], education: config?.education || [], blog: { source: config?.blog?.source, diff --git a/types/index.d.ts b/types/index.d.ts index e66253a..95e1f5f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -214,6 +214,11 @@ export interface Experience { to?: string; companyLink?: string; } +export interface Certifications { + body?: string; + name?: string; + year?: string; +} export interface Education { institution?: string; @@ -252,6 +257,11 @@ export interface Config { */ experiences?: Array; + /** + * Certifications list + */ + certifications?: Array; + /** * Education list */