Skip to content
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
31 changes: 31 additions & 0 deletions src/components/ContributionCard.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,34 @@
0 0 15px 2px rgba(249, 115, 22, 0.15),
0 0 30px 5px rgba(239, 68, 68, 0.08);
}

.contribution-card {
container-type: inline-size;
}

/* Hidden by default, shown only at medium widths */
.card-header-contributions-short {
display: none;
}

@container (max-width: 319px) {
.card-header-content {
flex-direction: column;
align-items: flex-start;
gap: 0.125rem;
}

.card-header-stats {
margin-left: 0;
}
}

@container (min-width: 320px) and (max-width: 399px) {
.card-header-contributions-label {
display: none;
}

.card-header-contributions-short {
display: inline;
}
}
13 changes: 8 additions & 5 deletions src/components/ContributionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function ContributionCard({
}
}

const sharedClass = `bg-gh-card rounded-xl px-5 py-4 transition-colors duration-150 w-full text-left ${
const sharedClass = `contribution-card bg-gh-card rounded-xl px-5 py-4 transition-colors duration-150 w-full text-left ${
hasStreak ? "streak-glow border border-transparent" : "border border-gh-border"
}`;

Expand All @@ -57,7 +57,7 @@ export default function ContributionCard({
onClick={isClickable ? handleSelect : undefined}
>
{/* Header */}
<div className="flex items-center gap-2.5 mb-3">
<div className="card-header flex items-center gap-2.5 mb-3">
<div className="relative w-8 h-8 shrink-0">
{(!result.data || !avatarLoaded) && (
<div className="absolute inset-0 rounded-full bg-gh-badge animate-pulse" />
Expand All @@ -71,7 +71,7 @@ export default function ContributionCard({
/>
)}
</div>
<div className="flex items-center justify-between w-full">
<div className="card-header-content flex items-center justify-between w-full">
<span className="font-semibold text-[15px]">
{username}
{hasStreak && (
Expand All @@ -85,9 +85,12 @@ export default function ContributionCard({
)}
</span>
{totalContributions != null ? (
<div className="flex items-center gap-2 ml-2">
<div className="card-header-stats flex items-center gap-2 ml-2">
<span className="text-gh-text-secondary text-xs font-bold">
{totalContributions} contributions
<span className="card-header-contributions-label">
{totalContributions} contributions
</span>
<span className="card-header-contributions-short">{totalContributions}</span>
</span>
{velocity && velocity.percentage !== 0 && (
<VelocityBadge velocity={velocity} periodDays={result.periodDays} />
Expand Down
Loading