Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Certifications section #234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
✓ [Social Links](#social-links)
✓ [Skill Section](#skills)
✓ [Experience Section](#experience)
✓ [Certifications Section](#certifications)
✓ [Education Section](#education)
✓ [Projects Section](#projects)
✓ [Blog Posts Section](#blog-posts)
Expand Down Expand Up @@ -243,6 +244,14 @@ const config = {
companyLink: 'https://example.com',
},
],
certifications: [
{
body: 'Certification Body Name',
name: 'Sample Certification',
year: 'March 2022',
certLink: 'https://example.com'
},
],
education: [
{
institution: 'Institution Name',
Expand Down Expand Up @@ -482,6 +491,27 @@ module.exports = {

Empty array will hide the experience section.

### Certifications

Provide your industry certifications in `certifications`.

```js
// gitprofile.config.js
module.exports = {
// ...
certifications: [
{
body: 'Certification Body Name',
name: 'My Sample Certification',
year: 'March 2022',
certLink: 'https://example.com'
},
],
};
```

Empty array will hide the certifications section.

### Education

Provide your education history in `education`.
Expand Down
8 changes: 8 additions & 0 deletions gitprofile.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ const config = {
companyLink: 'https://example.com',
},
],
certifications: [
{
body: 'Certification Body Name',
name: 'My Sample Certification',
year: 'March 2022',
certLink: 'https://example.com'
},
],
education: [
{
institution: 'Institution Name',
Expand Down
12 changes: 12 additions & 0 deletions src/components/GitProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -183,6 +184,10 @@ const GitProfile = ({ config }) => {
loading={loading}
experiences={sanitizedConfig.experiences}
/>
<Certifications
loading={loading}
certifications={sanitizedConfig.certifications}
/>
<Education
loading={loading}
education={sanitizedConfig.education}
Expand Down Expand Up @@ -272,6 +277,13 @@ GitProfile.propTypes = {
to: PropTypes.string,
})
),
certifications: PropTypes.arrayOf(
PropTypes.shape({
body: PropTypes.string,
name: PropTypes.string,
year: PropTypes.string,
})
),
education: PropTypes.arrayOf(
PropTypes.shape({
institution: PropTypes.string,
Expand Down
101 changes: 101 additions & 0 deletions src/components/certifications/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { skeleton } from '../../helpers/utils';
import { Fragment } from 'react';
import PropTypes from 'prop-types';

const ListItem = ({ year, name, body, certLink }) => (
<li className="mb-5 ml-4">
<div
className="absolute w-2 h-2 bg-base-300 rounded-full border border-base-300 mt-1.5"
style={{ left: '-4.5px' }}
></div>
<div className="my-0.5 text-xs">{year}</div>
<div className="font-semibold">
<a href={certLink} target="_blank" rel="noreferrer">
{name}
</a>
</div>
<h3 className="mb-4 font-normal">{body}</h3>
</li>
);

const Certifications = ({ certifications, loading }) => {
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 2; index++) {
array.push(
<ListItem
key={index}
year={skeleton({
width: 'w-5/12',
height: 'h-4',
})}
name={skeleton({
width: 'w-6/12',
height: 'h-4',
className: 'my-1.5',
})}
body={skeleton({ width: 'w-6/12', height: 'h-3' })}
/>
);
}

return array;
};

return (
<>
{certifications?.length !== 0 && (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<div className="mx-3">
<h5 className="card-title">
{loading ? (
skeleton({ width: 'w-32', height: 'h-8' })
) : (
<span className="text-base-content opacity-70">
Certifications
</span>
)}
</h5>
</div>
<div className="text-base-content text-opacity-60">
<ol className="relative border-l border-base-300 border-opacity-30 my-2 mx-4">
{loading ? (
renderSkeleton()
) : (
<Fragment>
{certifications.map((certification, index) => (
<ListItem
key={index}
year={`${certification.year}`}
name={certification.name}
body={certification.body}
certLink={
certification.certLink ? certification.certLink : null
}
/>
))}
</Fragment>
)}
</ol>
</div>
</div>
</div>
)}
</>
);
};

ListItem.propTypes = {
year: PropTypes.node,
name: PropTypes.node,
body: PropTypes.node,
certLink: PropTypes.string,
};

Certifications.propTypes = {
certifications: PropTypes.array.isRequired,
loading: PropTypes.bool.isRequired,
};

export default Certifications;
1 change: 1 addition & 0 deletions src/helpers/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ export interface Experience {
to?: string;
companyLink?: string;
}
export interface Certifications {
body?: string;
name?: string;
year?: string;
certLink?: string;
}

export interface Education {
institution?: string;
Expand Down Expand Up @@ -252,6 +258,11 @@ export interface Config {
*/
experiences?: Array<Experience>;

/**
* Certifications list
*/
certifications?: Array<Certifications>;

/**
* Education list
*/
Expand Down