Skip to content

Commit fd7b2f1

Browse files
bio section (#286)
* Add bio section in profile cards * no text if no bio --------- Co-authored-by: Priyansh Prajapat <[email protected]>
1 parent f65445f commit fd7b2f1

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

data.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@
11391139
"github": "https://github.com/mayurrogheliya",
11401140
"twitter": "https://x.com/MayurRogheliya",
11411141
"linkedin": "https://www.linkedin.com/in/mayur-rogheliya/",
1142-
"skills": ["MERN", "NextJS", "MySQL"]
1142+
"skills": ["MERN", "NextJS", "MySQL"],
1143+
"bio":"Aspiring MERN developer who loves building impactful web applications."
11431144
}
11441145
]

scripts/app.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ const displayProfiles = async (profiles) => {
3939
// Skills
4040
const skills = profile.skills.map(skill => `<span class="skill">${skill}</span>`).join('');
4141

42+
// Bio
43+
let bio = "";
44+
45+
if (profile.bio && profile.bio.trim() !== "") {
46+
const maxLength = 60;
47+
const bioText = profile.bio.length > maxLength
48+
? profile.bio.substring(0, maxLength) + "..."
49+
: profile.bio;
50+
bio = `<div class="bio"><p>${bioText}</p></div>`;
51+
}
52+
4253
// Social links with improved accessibility
4354
const social = `
4455
${profile.github ? `<a href="${profile.github}" target="_blank" aria-label="${profile.name}'s GitHub Profile"><i class="fa-brands fa-github"></i></a>` : ''}
@@ -53,6 +64,7 @@ const displayProfiles = async (profiles) => {
5364
</div>
5465
<h2 class="name">${profile.name}</h2>
5566
<div class="skills">${skills}</div>
67+
${bio}
5668
<div class="social">${social}</div>
5769
`;
5870

styles/style.css

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ h1 {
7171
display: flex;
7272
flex-direction: column;
7373
justify-content: space-between;
74-
min-height: 350px;
74+
gap: 15px;
7575
}
7676
.profile:hover {
7777
background-color: #333333;
@@ -89,27 +89,30 @@ h1 {
8989
.name {
9090
font-weight: 400;
9191
font-size: 20px;
92-
margin-bottom: 10px;
9392
}
9493

9594
.skills {
96-
margin-bottom: 10px;
9795
display: flex;
9896
flex-wrap: wrap;
9997
justify-content: center;
100-
row-gap: 7px;
98+
gap: 7px;
10199
}
102100

103101
.skill {
104102
background-color: #444444;
105103
padding: 5px 10px;
106104
border-radius: 5px;
107-
margin: 0 5px 10px 0;
108105
font-size: 14px;
109106
}
110107

108+
.profile .bio {
109+
color: #999;
110+
text-align: center;
111+
line-height: 1.4em;
112+
padding: 0 10px;
113+
}
114+
111115
.social {
112-
margin-top: 13px;
113116
display: flex;
114117
justify-content: center;
115118
background-color: #444444;
@@ -328,4 +331,4 @@ footer {
328331
.fbtn {
329332
margin-top: 0;
330333
}
331-
}
334+
}

0 commit comments

Comments
 (0)