Skip to content

Commit e920eac

Browse files
author
iitzIrFan
committed
Enhance Floating Contributors component with improved activity item styles and GitHub event links
1 parent 369c496 commit e920eac

File tree

2 files changed

+100
-5
lines changed

2 files changed

+100
-5
lines changed

src/components/FloatingContributors/FloatingContributors.css

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,24 @@
7474
padding: 8px 10px;
7575
border-radius: 10px;
7676
background-color: rgba(255, 255, 255, 0.08);
77-
transition: background-color 0.2s ease;
77+
transition: background-color 0.2s ease, transform 0.2s ease;
78+
cursor: pointer; /* Add pointer cursor to indicate clickable */
7879
}
7980

8081
.contributor-activity-item:hover {
81-
background-color: rgba(255, 255, 255, 0.12);
82+
background-color: rgba(255, 255, 255, 0.15);
83+
transform: translateY(-2px); /* Slight lift effect on hover */
84+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
85+
}
86+
87+
.contributor-activity-item:focus {
88+
outline: 2px solid rgba(102, 126, 234, 0.6);
89+
outline-offset: 2px;
90+
}
91+
92+
.contributor-activity-item:active {
93+
transform: translateY(0);
94+
background-color: rgba(255, 255, 255, 0.1);
8295
}
8396

8497
.activity-item-avatar {
@@ -269,12 +282,43 @@
269282
border: 1px solid rgba(255, 255, 255, 0.1);
270283
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
271284
cursor: pointer;
285+
position: relative;
286+
overflow: hidden;
272287
}
273288

274289
.floating-contributors-activity:hover {
275290
background: rgba(255, 255, 255, 0.08);
276291
border-color: rgba(102, 126, 234, 0.3);
292+
transform: translateY(-3px);
293+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
294+
}
295+
296+
.floating-contributors-activity:focus {
297+
outline: 2px solid rgba(102, 126, 234, 0.6);
298+
outline-offset: 2px;
299+
}
300+
301+
.floating-contributors-activity:active {
277302
transform: translateY(-1px);
303+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
304+
}
305+
306+
/* Subtle link indicator */
307+
.floating-contributors-activity::after {
308+
content: "→";
309+
position: absolute;
310+
right: 15px;
311+
top: 50%;
312+
transform: translateY(-50%) translateX(20px);
313+
opacity: 0;
314+
font-size: 16px;
315+
color: rgba(102, 126, 234, 0.8);
316+
transition: all 0.3s ease;
317+
}
318+
319+
.floating-contributors-activity:hover::after {
320+
transform: translateY(-50%) translateX(0);
321+
opacity: 1;
278322
}
279323

280324
[data-theme='light'] .floating-contributors-activity {
@@ -463,6 +507,30 @@
463507
transform: scale(1.1);
464508
}
465509

510+
.contributor-link {
511+
position: relative;
512+
display: block;
513+
transition: all 0.3s ease;
514+
}
515+
516+
.contributor-link::after {
517+
content: '';
518+
position: absolute;
519+
inset: 0;
520+
border-radius: 50%;
521+
border: 2px solid transparent;
522+
transition: all 0.3s ease;
523+
}
524+
525+
.contributor-link:focus {
526+
outline: none;
527+
}
528+
529+
.contributor-link:focus::after {
530+
border-color: rgba(102, 126, 234, 0.8);
531+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
532+
}
533+
466534
[data-theme='light'] .contributor-avatar {
467535
border-color: rgba(0, 0, 0, 0.2);
468536
}

src/components/FloatingContributors/index.tsx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,26 @@ const FloatingContributors: React.FC<FloatingContributorsProps> = ({ headerEmbed
390390
return () => clearInterval(interval);
391391
}, [activities.length]);
392392

393+
// Get GitHub URL for event
394+
const getGitHubEventUrl = (activity: ContributorActivity): string => {
395+
const repoUrl = 'https://github.com/recodehive/recode-website';
396+
397+
switch (activity.action) {
398+
case 'pushed':
399+
return `${repoUrl}/commits`;
400+
case 'merged':
401+
case 'opened':
402+
case 'closed':
403+
return `${repoUrl}/pulls`;
404+
case 'commented':
405+
return `${repoUrl}/issues`;
406+
case 'created':
407+
return repoUrl;
408+
default:
409+
return repoUrl;
410+
}
411+
};
412+
393413
// Get icon for action type
394414
const getActionIcon = (action: ContributorActivity['action']): string => {
395415
switch (action) {
@@ -477,11 +497,15 @@ const FloatingContributors: React.FC<FloatingContributorsProps> = ({ headerEmbed
477497
<AnimatePresence mode="wait">
478498
<motion.div
479499
key={currentActivityIndex}
480-
className="floating-contributors-activity"
500+
className="floating-contributors-activity contributor-activity-item"
481501
initial={{ opacity: 0, x: 20 }}
482502
animate={{ opacity: 1, x: 0 }}
483503
exit={{ opacity: 0, x: -20 }}
484504
transition={{ duration: 0.4 }}
505+
onClick={() => window.open(getGitHubEventUrl(currentActivity), '_blank')}
506+
tabIndex={0}
507+
role="link"
508+
aria-label={`View ${currentActivity.contributor.login}'s ${currentActivity.action} activity on GitHub`}
485509
>
486510
<div className="activity-avatar-container">
487511
<motion.img
@@ -538,6 +562,8 @@ const FloatingContributors: React.FC<FloatingContributorsProps> = ({ headerEmbed
538562
href={contributor.html_url}
539563
target="_blank"
540564
rel="noopener noreferrer"
565+
aria-label={`View ${contributor.login}'s GitHub profile`}
566+
className="contributor-link"
541567
>
542568
<img
543569
src={contributor.avatar_url}
@@ -563,15 +589,16 @@ const FloatingContributors: React.FC<FloatingContributorsProps> = ({ headerEmbed
563589
{/* Footer */}
564590
<div className="floating-contributors-footer">
565591
<motion.a
566-
href="https://github.com/recodehive"
592+
href="https://github.com/recodehive/recode-website"
567593
target="_blank"
568594
rel="noopener noreferrer"
569595
className="contributors-cta"
570596
whileHover={{ scale: 1.02 }}
571597
whileTap={{ scale: 0.98 }}
598+
aria-label="View repository on GitHub and join the community"
572599
>
573600
<span className="cta-icon">🚀</span>
574-
<span>Join the Community</span>
601+
<span>View Repository on GitHub</span>
575602
<span className="cta-arrow"></span>
576603
</motion.a>
577604
</div>

0 commit comments

Comments
 (0)