The ProjectCards component is a dynamic and visually engaging grid of project cards. This guide will help you:
Edit or add project items (titles, descriptions, images, and links).
Customize animations (timing, easing, and delays).
Adjust layout and styling (grid structure, spacing, and hover effects).
Ensure accessibility and responsiveness.
Project Resources
Tutorial
Step 1: Editing the projects
Array
Locate the projects
Array
The projects
array defines all the content for the cards displayed in the grid:
Edit Existing Items
name
: Title displayed on the card.category
: Category label above the project name.href
: Link where the card directs users upon clicking.description
: Brief description of the project.imageSrc
: Path or URL to the project image.imageAlt
: Text describing the image for accessibility.
Example Update:
Add New Items
Add new objects to the projects
array with unique id
values.
Example:
Remove Items
Delete any unwanted objects from the array.
Step 2: Customizing Animations
Title Animation
The title uses a fade-in animation:
Adjust Animation Duration:
Change Easing:
Card Animation
Cards use staggered fade-in effects with easing:
Change Stagger Delay: Modify
delay: index * 0.5
for faster or slower stagger.Adjust Duration: Increase or decrease
duration
for smoother or quicker animations.Try Different Easing: Replace
ease
with a preset like"easeOut"
or a custom cubic-bezier value.
Step 3: Adjusting Layout and Styling
Grid Layout
The grid layout is controlled with Tailwind classes:
Number of Columns:
Single column:
grid-cols-1
Two columns:
md:grid-cols-2
Three columns:
lg:grid-cols-3
Spacing Between Cards:
Horizontal spacing:
sm:gap-x-6
Vertical spacing:
sm:gap-y-10
Example Update:
Card Styling
The card styling includes hover effects and rounded corners:
Change Border Radius:
Modify Hover Effects:
Step 4: Accessibility Enhancements
Alt Text for Images
Ensure every
imageAlt
in theprojects
array is meaningful for screen readers and SEO.
ARIA Roles and Labels
Add
aria-label
to links for better screen reader support:
Step 5: Testing and Optimization
Run Locally: Use
npm run dev
to preview changes.Responsive Testing: Verify the component looks great on all screen sizes.
Performance Optimization:
Use
.webp
images for smaller file sizes.Lazy-load images using the
loading="lazy"
attribute.