Skip to content

Refactor ProjectCard layout to use backdrop image with content overlay - #4

Merged
MatejMa2ur merged 2 commits into
mainfrom
claude/projects-page-display-ig2b5k
Sep 5, 2026
Merged

Refactor ProjectCard layout to use backdrop image with content overlay#4
MatejMa2ur merged 2 commits into
mainfrom
claude/projects-page-display-ig2b5k

Conversation

@MatejMa2ur

Copy link
Copy Markdown
Member

Summary

Redesigned the ProjectCard component to use a backdrop image layer behind text content rather than a fixed-height image block. This allows cards to grow with their content while maintaining readability through a tinted gradient overlay.

Key Changes

Component Structure (ProjectCard.astro)

  • Changed from <div> to semantic <article> element
  • Restructured layout: image now positioned absolutely as a backdrop, with content overlaid on top
  • Added conditional rendering for image and description to handle missing data gracefully
  • Improved tech list filtering to remove empty strings from split operation
  • Added error handling for broken images with onerror handler

Layout & Styling

  • Image now uses position: absolute; inset: 0 to fill the card as a backdrop
  • Created new .project-tint layer combining brand gradient with bottom-up scrim for text contrast
  • .project-content uses flexbox with flex: 1 1 auto to anchor text to bottom while allowing card to grow
  • Set minimum height of 240px on content area (previously on image)
  • Replaced three separate gradient overlays with single unified tint layer
  • Added fallback background gradient to card for when image is missing or broken

Responsive & Interactive Improvements

  • Buttons now use flexbox gap spacing instead of margin utilities
  • Enhanced button visibility: buttons show on hover, focus-visible, and always on touch/mobile devices
  • Updated media query to use (hover: none) to detect touch devices
  • Responsive padding on content area (1rem on mobile, 1.5rem on desktop)

Project Content Updates

  • Migrated project images from external URLs to local assets in /img/projects/
  • Updated three projects: Cod3rs Community, Community.Blazor.MapLibre, and Hack The Flag
  • Added corresponding image files to public directory

Implementation Details

  • The card maintains a minimum height but grows with content, preventing text overflow
  • The tinted gradient sits on the card itself, ensuring readability even with missing/broken images
  • Image filter (saturate, contrast) and hover zoom effect preserved
  • Accessibility improved with focus-visible state for keyboard navigation
  • Touch device detection prevents hidden buttons on devices without hover capability

https://claude.ai/code/session_01XVdiFBajKv1UbARQujNq5j

Two projects pointed at image URLs that no longer resolve, and the card
layout couldn't cope with the result:

- Community.Blazor.MapLibre referenced .../examples/globe.png, which 404s;
  the file in the MapLibre repo is render-globe.png. Hack The Flag hotlinked
  app.hacktheflag.net, which is not serving the logo. Both images are now
  self-hosted under public/img/projects/ so the cards no longer depend on
  another host staying up.
- ProjectCard laid the text over a fixed 240px image block with absolute
  positioning, so longer titles and tech lists spilled past the top of the
  tile and were clipped, and a failed image left a white box with white text
  on it plus the browser's alt-text fallback.

The card now uses the image as a backdrop layer with the text in normal
flow: the tile keeps a 240px minimum height but grows with its content, the
scrim and a dark fallback background live on the card itself so text stays
readable with or without an image, and a broken image is hidden outright.
Also keeps the hover buttons reachable via keyboard focus.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XVdiFBajKv1UbARQujNq5j
Same image as the hotlinked cod3rs.org/img/logo.png, fetched from the
Cod3rs-org GitHub organisation avatar, so the card no longer depends on
another host serving it.

Hack Esbjerg still points at hack-esbjerg.cod3rs.org; that host and the
project's repository are both out of reach from here, so its image was
left as-is.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XVdiFBajKv1UbARQujNq5j
@MatejMa2ur
MatejMa2ur merged commit 32b53eb into main Sep 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants