Workshop: Portfolio v2 with Animations
Project Brief
Section titled “Project Brief”Portfolio v2 with Animations
สร้าง Portfolio เวอร์ชัน 2 ที่มี animation สวยงาม — Dark mode, hover effect, scroll animation, page transition และ responsive 100%
- Dark mode design
- Hover animations บนปุ่มและ card
- Scroll animations สำหรับแต่ละ section
- Page transitions ด้วย AnimatePresence
- 100% Responsive ทุกขนาดหน้าจอ
- Deploy ขึ้น Vercel หรือ Netlify
Deploy to: Vercel or Netlify
What you'll build Preview
Portfolio
About Projects Contact
Hello, I'm Alex Designer UX/UI Engineer
View My Work
Projects Todo App Dashboard Blog
Get in Touch
your@email.com
Send
Project Structure
Section titled “Project Structure”Directoryportfolio-v2/
Directorysrc/
- App.jsx Main app component
Directorycomponents/
- Navbar.jsx Navigation bar พร้อม scroll effect
- Hero.jsx Hero section พร้อม entrance animation
- About.jsx About section พร้อม scroll animation
- Projects.jsx Projects grid พร้อม stagger + hover
- Contact.jsx Contact section พร้อม animation
Directoryanimations/
- variants.js Shared animation variants
- package.json Dependencies รวม motion
Step-by-Step Instructions
Section titled “Step-by-Step Instructions”-
สร้างโปรเจกต์ React + Tailwind
ใช้ Vite สร้างโปรเจกต์ใหม่ แล้วติดตั้ง dependencies:
Terminal window npm create vite@latest portfolio-v2 -- --template reactcd portfolio-v2npm installnpm install motionnpm install -D tailwindcss @tailwindcss/viteจากนั้นเพิ่ม Tailwind CSS ใน CSS file หลัก:
src/index.css @import "tailwindcss"; -
สร้างไฟล์ variants.js
สร้างโฟลเดอร์
src/animations/แล้วสร้างไฟล์variants.jsรวม animation variants ที่จะใช้ซ้ำ:fadeInUp— fade in พร้อมเลื่อนขึ้นfadeIn— fade in อย่างเดียวstaggerContainer— container ที่ stagger childrenscaleOnHover— ขยายเมื่อ hoverslideInLeft/slideInRight— เลื่อนเข้าจากซ้าย/ขวา
-
สร้าง Navbar.jsx
สร้าง navigation bar ที่มีฟีเจอร์:
- เปลี่ยน background เมื่อ scroll ลงมา (ใช้
useState+useEffectฟัง scroll event) - Smooth scroll ไปยังแต่ละ section
- Entrance animation ด้วย
motion.nav - Mobile responsive menu
- เปลี่ยน background เมื่อ scroll ลงมา (ใช้
-
สร้าง Hero.jsx
สร้าง Hero section พร้อม animation:
- Delay chaining — subtitle, title, description, button เข้ามาตามลำดับ
- Button มี
whileHover+whileTap - Full screen height (
min-h-screen) - Dark theme background
-
สร้าง About.jsx
สร้าง About section:
- ใช้
whileInViewให้ animate เมื่อ scroll มาถึง viewport={{ once: true }}ให้ animate ครั้งเดียว- แสดง skill list ด้วย stagger animation
- Layout 2 คอลัมน์บน desktop
- ใช้
-
สร้าง Projects.jsx
สร้าง Projects section:
- Grid layout แสดง project cards
- Card มี
whileHovereffect (ยกขึ้น + เงา) - Stagger animation เมื่อ scroll มาถึง
- แต่ละ card มี title, description, tech tags, link
-
สร้าง Contact.jsx
สร้าง Contact section:
- Contact form หรือ contact info
- Scroll animation ด้วย
whileInView - Social links พร้อม hover animation
- Footer area
-
รวมทุกอย่างใน App.jsx แล้ว Deploy
- Import ทุก component มารวมใน
App.jsx - เพิ่ม
ScrollProgressbar (optional) - ทดสอบ responsive ทุกขนาดหน้าจอ
- Deploy ขึ้น Vercel หรือ Netlify:
Terminal window # Vercelnpm install -g vercelvercel# หรือ Netlifynpm run build# ลาก dist/ folder ไปที่ netlify.com/drop - Import ทุก component มารวมใน
เมื่อทำเสร็จแล้ว ไปดูเฉลยได้ที่ Solution เพื่อเทียบกับงานของคุณ