Skip to content

TrenchesProgrammer/profile-card

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Profile Card Component

A modern, accessible, and responsive profile card built with semantic HTML, vanilla CSS, and JavaScript. This component showcases a user profile with avatar, bio, social links, hobbies, and dislikes.

🌐 Live Demo

View Live Demo

πŸ“‹ Features

  • Semantic HTML - Uses proper HTML5 semantic tags (article, figure, section, nav, etc.)
  • Fully Accessible - WCAG compliant with proper ARIA labels, alt text, and keyboard navigation
  • Responsive Design - Mobile-first approach, optimized for mobile, tablet, and desktop screens
  • Modern Styling - Gradient backgrounds, smooth transitions, and hover effects
  • Test-Ready - All elements include data-testid attributes for automated testing
  • Keyboard Navigation - Full focus management with visible focus indicators

πŸ› οΈ Tech Stack

  • HTML5 - Semantic markup
  • CSS3 - Flexbox, gradients, media queries
  • Vanilla JavaScript - No frameworks or dependencies

πŸ“ Project Structure

stage-0/
β”œβ”€β”€ index.html          # Main HTML file
β”œβ”€β”€ styles.css          # Stylesheet
β”œβ”€β”€ index.js            # JavaScript logic
β”œβ”€β”€ avatar.png          # Profile avatar image
β”œβ”€β”€ twitter-icon.svg    # Social media icons
β”œβ”€β”€ linkedin-icon.svg
β”œβ”€β”€ github-icon.svg
β”œβ”€β”€ favicon.ico         # Favicon
└── README.md           # This file

πŸš€ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • No build tools or dependencies required

Installation & Local Development

  1. Clone the repository

    git clone https://github.com/your-username/profile-card.git
    cd profile-card
  2. Open in your browser

    • Option A: Double-click index.html to open directly
    • Option B: Use a local server (recommended)
      # Using Python 3
      python -m http.server 8000
      
      # Using Python 2
      python -m SimpleHTTPServer 8000
      
      # Using Node.js (if you have http-server installed)
      npx http-server
    • Navigate to http://localhost:8000

πŸ“ Customization

Update Profile Information

Edit index.html to customize:

<h2 data-testid="test-user-name">Your Name</h2>
<h3>Your Title</h3>
<p data-testid="test-user-bio">Your bio here...</p>

Add/Edit Hobbies and Dislikes

<ul data-testid="test-user-hobbies">
  <li>Your Hobby 1</li>
  <li>Your Hobby 2</li>
  <li>Your Hobby 3</li>
</ul>

Update Social Links

<li data-testid="test-user-social-twitter">
  <a rel="noopener noreferrer" target="_blank" href="your-link">
    <img class="icon" src="./twitter-icon.svg" alt="twitter-icon" />
  </a>
</li>

Modify Styling

All styles are in styles.css. Key customization points:

  • Colors: Update gradient colors in .main and .hobbies classes
  • Avatar Size: Adjust .image-bg height/width
  • Card Width: Modify .main width property
  • Breakpoints: Update media query at 520px for different screen sizes

β™Ώ Accessibility Features

βœ“ Semantic HTML structure
βœ“ Descriptive alt text for images
βœ“ Keyboard-navigable links with visible focus states
βœ“ Proper heading hierarchy (h1 β†’ h3)
βœ“ Color contrast meets WCAG AA standards
βœ“ All interactive elements are keyboard accessible
βœ“ rel="noopener noreferrer" on external links

βœ… Requirements Checklist

  • Profile card root container (test-profile-card)
  • User name element (test-user-name)
  • Bio paragraph (test-user-bio)
  • Current time in milliseconds (test-user-time)
  • Avatar image with alt text (test-user-avatar)
  • Social links list (test-user-social-links)
  • Individual social link testids (test-user-social-*)
  • Hobbies list (test-user-hobbies)
  • Dislikes list (test-user-dislikes)
  • Semantic HTML tags
  • Responsive design (mobile/tablet/desktop)
  • Keyboard navigation support
  • Visible focus indicators

πŸ“± Responsive Breakpoints

  • Mobile: < 520px - Stacked vertical layout
  • Tablet/Desktop: β‰₯ 520px - Side-by-side layout with avatar on left

πŸ§ͺ Testing

All elements include data-testid attributes for automated testing:

// Example test queries
const profileCard = document.querySelector('[data-testid="test-profile-card"]');
const userName = document.querySelector('[data-testid="test-user-name"]');
const userBio = document.querySelector('[data-testid="test-user-bio"]');
const currentTime = document.querySelector('[data-testid="test-user-time"]');
const avatar = document.querySelector('[data-testid="test-user-avatar"]');
const socialLinks = document.querySelector('[data-testid="test-user-social-links"]');
const hobbies = document.querySelector('[data-testid="test-user-hobbies"]');
const dislikes = document.querySelector('[data-testid="test-user-dislikes"]');

🌐 Deployment

Deploy to Netlify

  1. Push your code to GitHub
  2. Go to Netlify
  3. Click "New site from Git"
  4. Select your repository
  5. Click "Deploy"

Deploy to GitHub Pages

  1. Push your code to GitHub
  2. Go to repository Settings β†’ Pages
  3. Select "main" branch as source
  4. Your site will be live at https://your-username.github.io/profile-card

πŸ“„ License

This project is open source and available under the MIT License.

πŸ‘€ Author

Ajadi Ireanuoluwa
Frontend Developer | Blockchain Enthusiast

🀝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs via GitHub Issues
  • Submit pull requests with improvements
  • Suggest new features

πŸ“ž Support

Have questions? Create an issue in the repository or reach out on social media.


Happy coding! πŸš€

About

HNG13 Stage 0 task

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published