GameCard Component
TheGameCard is an Astro component that displays a clickable card for a game, featuring version information, a countdown timer, and a themed background image. It’s used on the home page to show all tracked games in a grid layout.
Props
The component receives props viaAstro.props:
The game title (e.g., “Genshin Impact”, “Honkai: Star Rail”)
Current version number (e.g., “5.4”)
Upcoming version number (e.g., “5.5”)
URL or path to the background image for the card
Start date for the countdown timer
Duration in days for the countdown period
Theme color for the current version badge (CSS color value)
Relative URL path for the game detail page (e.g., “/genshin”)
Usage Example
Home Page Implementation
Visual Structure
The GameCard is composed of several layers:1. Container Link
- Full card is clickable link to game detail page
groupclass enables hover effects on children- Fixed height with flex layout pushing content to bottom
2. Background Layer
- Covers entire card with background image
- Gradient overlay from transparent to dark for text readability
- Scale animation on hover (110% zoom)
3. Current Version Badge
- Glass panel effect in top-right corner
- Dynamic theme color from props
- Shows current version
4. Content Section
- Game title with pulsing live indicator
- Upcoming version information
- Counter component in “mini” variant (default)
5. Bottom Accent Bar
- Animated bar that expands on hover
- Uses theme-specific color
Hover Effects
- Background
- Shadow
- Accent Bar
- Background image scales to 110%
- 700ms smooth transition
- Creates zoom effect while keeping card size fixed
Integration with Counter
The GameCard integrates the Counter component with:client:loaddirective for hydrationfecha_inicioandduracion_diaspassed through- Default “mini” variant (prop omitted)
The Counter component defaults to “mini” variant, which displays a compact 4-column grid perfect for card layouts.
Styling Classes
Custom Classes
glass-panel: Glassmorphism effect for badgesborder-genshin/30: Theme-specific border with opacitybg-background-dark: Dark background color from theme
Responsive Design
- Fixed height maintains consistent grid layout
- Text sizes optimize for mobile and desktop
- Grid container uses
grid-cols-1 md:grid-cols-2for responsive columns
Accessibility
The component includes:- Semantic HTML with proper
<a>tag for navigation - Alt text via
data-altattribute on background div - Sufficient color contrast with gradient overlay
- Clear visual indicators for interactive elements
Source Location
The GameCard component is located at:src/components/GameCard.astro