TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ludwiigdev/Heroes_App/llms.txt
Use this file to discover all available pages before exploring further.
HeroCard component is the primary visual unit for displaying a single superhero. It renders a richly styled card containing the hero’s photo, superhero name, alter ego, debut comic issue, and character list. Each card is wrapped in a React Router Link, so clicking anywhere on it navigates the user to that hero’s dedicated detail page. On mount the card plays a subtle animate__pulse animation courtesy of Animate.css, giving the listing page a lively feel without requiring any manual trigger.
Props
All five props come directly from the hero data object stored insrc/Heroes/data/heroes.js and are spread onto HeroCard by HeroList.
The unique hero identifier (e.g.
"dc-batman", "marvel-spider"). Used to build both the image URL (/heroes/${id}.jpg) and the navigation target (/hero/${id}).The hero’s superhero name (e.g.
"Batman", "Spider-Man"). Rendered in the .profile-name overlay and used as the alt attribute on the card image.The hero’s civilian identity (e.g.
"Bruce Wayne"). Displayed below the superhero name in the .profile-position overlay.The comic issue in which the hero first appeared (e.g.
"Detective Comics #27"). Shown in the bottom gradient overlay inside .profile-overview, preceded by the Spanish label “Primera aparición:”.A comma-separated list of characters who have held the role (e.g.
"Jay Garrick, Barry Allen, Wally West, Bart Allen"). Only rendered when it differs from alter_ego — see Conditional characters display below.Image URL convention
The card image is resolved at runtime using theid prop:
public/heroes/ directory of the Vite project and are served as static assets. The filename must match the hero’s id exactly (e.g. public/heroes/dc-batman.jpg). Because Vite copies everything in public/ to the build output root, the path /heroes/${id}.jpg resolves correctly in both development and production.
If an image file is missing for a given hero, the browser will show the broken-image fallback. The
alt attribute (superhero) ensures screen readers still announce the hero’s name.Conditional characters display
Thecharacters field lists every person who has taken on the superhero mantle. When a hero has only one person behind the mask that value is identical to alter_ego, so printing it twice would be redundant. HeroCard avoids the repetition with a simple inequality check:
| Scenario | alter_ego | characters | Rendered? |
|---|---|---|---|
| Single identity | "Bruce Wayne" | "Bruce Wayne" | ❌ Hidden |
| Multiple identities | "Jay Garrick" | "Jay Garrick, Barry Allen, Wally West, Bart Allen" | ✅ Shown |
Navigation with Link
The entire card surface is wrapped in a React Router<Link>:
/hero/${id}, which renders HeroPage. No separate click handler is needed.
Animation behavior
HeroCard applies two Animate.css utility classes directly to the <Link> element:
| Class | Purpose |
|---|---|
animate__animated | Required base class that activates Animate.css transitions |
animate__pulse | Plays a single, smooth pulse scale on mount |
CSS class breakdown
The.my-card class in src/styles.css creates a layered overlay card using absolute positioning:
View full .my-card CSS structure
View full .my-card CSS structure
- Hero image — fills the card, dimmed to 70% brightness
.profile-name— absolute top-left, always visible.profile-position— absolute, just below the name.profile-overview— absolute bottom, gradient background, containsfirst_appearanceand optionallycharacters
