Day 1 — ProfileCard
Day 1 · Topic 11 of 15Hands-on practice
Foundations & build/ProfileCard
01
Hands-on #01 — Build Your ProfileCard Component
Hands-on #01
Build Your ProfileCard Component
Create one reusable card template with consistent prop names.
Exercise
- Create
src/components/ProfileCard.js - Your ProfileCard will use these props:
name,title,desc, andimageSrc. Start with the three text props; you will addimageSrcin Hands-on #02. - Display the three text props in your JSX.
Copy this starter with name, title, and desc:
src/components/ProfileCard.js
1export function ProfileCard({ name, title, desc }) {2 return (3 <div className="flex items-center gap-4 text-gray-900">4 <div>5 <h2 className="text-xl font-semibold">{name}</h2>6 <p className="text-gray-600">{title}</p>7 <p className="mt-1 text-sm">{desc}</p>8 </div>9 </div>10 );11}How every element works
export function ProfileCard(…)— creates a reusable component other files can import.{ name, title, desc }— props boxes. Parent pages pass values in; this component receives them.return ( … )— what React shows on screen (must return JSX).- Outer
divwithflex items-center gap-4— lays content in a row with spacing (room for a photo later). {name},{title},{desc}— curly braces inject the prop values into JSX.- Tailwind classes like
text-xl,font-semibold,text-gray-600— style without a separate CSS file.
What about the image?
Next hands-on — the Next.js <Image /> component.
Done when
src/components/ProfileCard.js exports a component that receives name, title, and desc. It will appear in the browser after you import it in Hands-on #03.