Overview
TheUserCard component displays comprehensive GitHub user profile information including avatar, name, bio, social links, and key statistics (repositories, followers, following, gists).
Location in UI: Left sidebar, below the header when user data is loaded
Source: ~/workspace/source/src/components/UserCard.jsx
Props
GitHub user data object returned from the GitHub API. Contains profile information and statistics.
Usage Example
FromApp.jsx:101:
App.jsx:45-46:
Key Features
Profile Header
Displays avatar, name, and GitHub link:user.login if user.name is not available.
Social Metadata
Conditionally renders social information with icons:https:// if protocol is missing, and strips protocol from display text.
Statistics Grid
Displays four key metrics using theStat subcomponent:
Subcomponents
Stat Component
Helper component for displaying individual statistics:- Formats numbers with locale-specific separators (e.g.,
1000→1,000) - Shows em dash (
—) if value is null/undefined
Implementation Details
Icons Used
From Lucide React:Building2- CompanyMapPin- LocationLink- Website/blogTwitter- Twitter handle
External Links
All external links use:target="_blank"- Opens in new tabrel="noreferrer"- Security best practice
Animation
Applies fade-up animation on mount:Styling
Imports modular CSS fromUserCard.module.css for component-scoped styles.
Conditional Rendering
Only renders fields that have values:- Bio displayed only if
user.bioexists - Each metadata item checks for existence before rendering
- Statistics use
??operator for null/undefined handling