mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-23 00:20:40 +07:00
added animation for home page
This commit is contained in:
1 parent
531c70e13a
commit
1800fa7ceb
15 files changed
+1192
-152
No files matched your search
@@ -0,0 +1,457 @@
|
||||
# UI Spec - Motion Animations (Homepage)
|
||||
|
||||
## Overview
|
||||
|
||||
Thêm animations cho toàn bộ homepage sử dụng **motion** library (`motion/react`). Tất cả animations dùng motion API, không CSS keyframes.
|
||||
|
||||
---
|
||||
|
||||
## Dependency
|
||||
|
||||
```bash
|
||||
pnpm add motion
|
||||
```
|
||||
|
||||
```tsx
|
||||
import { motion } from "motion/react"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Animation Categories
|
||||
|
||||
### 1. Enter Animations (Page Load)
|
||||
|
||||
| Component | Prop | Values | Transition |
|
||||
|---|---|---|---|
|
||||
| Hero container | `initial` → `animate` | `opacity: 0, x: -30` → `opacity: 1, x: 0` | `duration: 0.6, delay: 0.2` |
|
||||
| Hero name | `initial` → `animate` | `opacity: 0, y: 20` → `opacity: 1, y: 0` | `duration: 0.5, delay: 0.3` |
|
||||
| Hero title | `initial` → `animate` | `opacity: 0, y: 20` → `opacity: 1, y: 0` | `duration: 0.5, delay: 0.4` |
|
||||
| Hero tagline | `initial` → `animate` | `opacity: 0, y: 20` → `opacity: 1, y: 0` | `duration: 0.5, delay: 0.5` |
|
||||
| Hero CTA buttons | `initial` → `animate` | `opacity: 0, y: 20` → `opacity: 1, y: 0` | `duration: 0.5, delay: 0.6` |
|
||||
| Hero visual (photo) | `initial` → `animate` | `opacity: 0, x: 30` → `opacity: 1, x: 0` | `duration: 0.6, delay: 0.4` |
|
||||
| OpenToWorkBadge | `initial` → `animate` | `opacity: 0, y: -20` → `opacity: 1, y: 0` | `duration: 0.5, delay: 0.3` |
|
||||
|
||||
### 2. Gesture Animations (Hover/Tap)
|
||||
|
||||
| Component | Prop | Values |
|
||||
|---|---|---|
|
||||
| CTA buttons | `whileHover` | `scale: 1.05` |
|
||||
| CTA buttons | `whileTap` | `scale: 0.95` |
|
||||
| Project cards | `whileHover` | `scale: 1.02, y: -4` |
|
||||
| Project cards | `whileTap` | `scale: 0.98` |
|
||||
| Social links | `whileHover` | `scale: 1.1` |
|
||||
| Social links | `whileTap` | `scale: 0.9` |
|
||||
| Skill items | `whileHover` | `scale: 1.05, y: -2` |
|
||||
| Skill items | `whileTap` | `scale: 0.98` |
|
||||
|
||||
### 3. Scroll Animations (whileInView)
|
||||
|
||||
| Component | Prop | Values |
|
||||
|---|---|---|
|
||||
| Section titles | `initial` → `whileInView` | `opacity: 0, y: 30` → `opacity: 1, y: 0` |
|
||||
| Expertise cards | `initial` → `whileInView` | `opacity: 0, y: 30` → `opacity: 1, y: 0` |
|
||||
| Experience entries | `initial` → `whileInView` | `opacity: 0, y: 30` → `opacity: 1, y: 0` |
|
||||
| Project cards | `initial` → `whileInView` | `opacity: 0, y: 30` → `opacity: 1, y: 0` |
|
||||
| Contact section | `initial` → `whileInView` | `opacity: 0, y: 30` → `opacity: 1, y: 0` |
|
||||
|
||||
**Viewport config:**
|
||||
```tsx
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
transition={{ duration: 0.5 }}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Reusable Components
|
||||
|
||||
### `src/components/ui/InView.tsx`
|
||||
|
||||
Wrapper component cho scroll animations.
|
||||
|
||||
```tsx
|
||||
import { motion, type MotionProps } from "motion/react"
|
||||
import { ReactNode } from "react"
|
||||
|
||||
interface InViewProps extends Omit<MotionProps, "children"> {
|
||||
children: ReactNode
|
||||
delay?: number
|
||||
threshold?: number
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function InView({
|
||||
children,
|
||||
delay = 0,
|
||||
threshold = 0.1,
|
||||
className,
|
||||
...props
|
||||
}: InViewProps) {
|
||||
return (
|
||||
<motion.div
|
||||
className={className}
|
||||
initial={{ opacity: 0, y: 30 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: threshold }}
|
||||
transition={{ duration: 0.5, delay }}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
```tsx
|
||||
<InView delay={0.1}>
|
||||
<h2>Section Title</h2>
|
||||
</InView>
|
||||
```
|
||||
|
||||
### `src/components/ui/GestureButton.tsx`
|
||||
|
||||
Wrapper cho hover/tap animations.
|
||||
|
||||
```tsx
|
||||
import { motion, type MotionProps } from "motion/react"
|
||||
import { ComponentPropsWithRef, ElementType } from "react"
|
||||
|
||||
interface GestureButtonProps extends MotionProps {
|
||||
as?: ElementType
|
||||
className?: string
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export function GestureButton({ as: Tag = "button", className, ...props }: GestureButtonProps) {
|
||||
const MotionTag = motion(Tag as any)
|
||||
return (
|
||||
<MotionTag
|
||||
className={className}
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Component Updates
|
||||
|
||||
### `src/components/sections/Hero.tsx`
|
||||
|
||||
Wrap các phần tử với motion:
|
||||
|
||||
```tsx
|
||||
import { motion } from "motion/react"
|
||||
|
||||
export function Hero() {
|
||||
return (
|
||||
<motion.section
|
||||
className="hero container-wide"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
transition={{ duration: 0.3 }}
|
||||
aria-labelledby="hero-heading"
|
||||
>
|
||||
<motion.div
|
||||
className="hero-content"
|
||||
initial={{ opacity: 0, x: -30 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
transition={{ duration: 0.6, delay: 0.2 }}
|
||||
>
|
||||
<motion.h1
|
||||
id="hero-heading"
|
||||
className="hero-name"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.3 }}
|
||||
>
|
||||
{profile.name}
|
||||
</motion.h1>
|
||||
<motion.p
|
||||
className="hero-title"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.4 }}
|
||||
>
|
||||
{profile.title}
|
||||
</motion.p>
|
||||
<motion.p
|
||||
className="hero-tagline"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.5 }}
|
||||
>
|
||||
{profile.tagline}
|
||||
</motion.p>
|
||||
<motion.div
|
||||
className="hero-cta"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.6 }}
|
||||
>
|
||||
<Button href="/projects" variant="primary">
|
||||
View Projects
|
||||
</Button>
|
||||
{resumeAvailable && (
|
||||
<Button href="/resume.pdf" variant="secondary" download>
|
||||
Download Resume
|
||||
</Button>
|
||||
)}
|
||||
<Button href="/contact" variant="secondary">
|
||||
Contact Me
|
||||
</Button>
|
||||
</motion.div>
|
||||
<SocialLinks links={socialLinks} />
|
||||
</motion.div>
|
||||
<motion.div
|
||||
className="hero-visual"
|
||||
initial={{ opacity: 0, x: 30 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
transition={{ duration: 0.6, delay: 0.4 }}
|
||||
>
|
||||
<img src="/profile-photo.webp" alt="Profile photo" className="hero-photo" />
|
||||
<OpenToWorkBadge />
|
||||
</motion.div>
|
||||
</motion.section>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### `src/components/ui/Button.tsx`
|
||||
|
||||
Thêm hover/tap animation:
|
||||
|
||||
```tsx
|
||||
import { motion } from "motion/react"
|
||||
|
||||
// Thay thế <button> bằng:
|
||||
<motion.button
|
||||
className={`btn btn-${variant}`}
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
whileFocus={{ scale: 1.05 }}
|
||||
{...buttonProps}
|
||||
>
|
||||
{children}
|
||||
</motion.button>
|
||||
```
|
||||
|
||||
### `src/components/sections/ExpertiseSection.tsx`
|
||||
|
||||
Wrap section và stagger children:
|
||||
|
||||
```tsx
|
||||
import { motion } from "motion/react"
|
||||
|
||||
export function ExpertiseSection() {
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
className="expertise-section container-wide"
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: {
|
||||
opacity: 1,
|
||||
transition: { staggerChildren: 0.1 }
|
||||
}
|
||||
}}
|
||||
>
|
||||
<motion.h2 className="section-title" variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: { opacity: 1, y: 0, transition: { duration: 0.5 } }
|
||||
}}>
|
||||
Core Expertise
|
||||
</motion.h2>
|
||||
<div className="expertise-grid">
|
||||
{expertiseGroups.map((group, i) => (
|
||||
<motion.div
|
||||
key={group.title}
|
||||
className="expertise-card"
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: { opacity: 1, y: 0, transition: { duration: 0.5, delay: i * 0.1 } }
|
||||
}}
|
||||
whileHover={{ scale: 1.05, y: -2 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<h3>{group.title}</h3>
|
||||
<ul>
|
||||
{group.skills.map(skill => (
|
||||
<li key={skill}>{skill}</li>
|
||||
))}
|
||||
</ul>
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
</motion.section>
|
||||
</InView>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### `src/components/sections/ExperienceSection.tsx`
|
||||
|
||||
```tsx
|
||||
<InView>
|
||||
<motion.section
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: { opacity: 1, transition: { staggerChildren: 0.15 } }
|
||||
}}
|
||||
>
|
||||
<motion.h2 variants={titleVariants}>Experience</motion.h2>
|
||||
{experience.map((exp, i) => (
|
||||
<motion.div
|
||||
key={exp.company}
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: { opacity: 1, y: 0, transition: { duration: 0.5, delay: i * 0.15 } }
|
||||
}}
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
{/* Experience content */}
|
||||
</motion.div>
|
||||
))}
|
||||
</motion.section>
|
||||
</InView>
|
||||
```
|
||||
|
||||
### `src/components/sections/ProjectsSection.tsx`
|
||||
|
||||
```tsx
|
||||
<InView>
|
||||
<motion.section
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: { opacity: 1, transition: { staggerChildren: 0.1 } }
|
||||
}}
|
||||
>
|
||||
<motion.h2 variants={titleVariants}>Featured Projects</motion.h2>
|
||||
<div className="projects-grid">
|
||||
{projects.map((project, i) => (
|
||||
<motion.div
|
||||
key={project.title}
|
||||
className="project-card"
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: { opacity: 1, y: 0, transition: { duration: 0.5, delay: i * 0.1 } }
|
||||
}}
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
{/* Project content */}
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
</motion.section>
|
||||
</InView>
|
||||
```
|
||||
|
||||
### `src/components/sections/ContactSection.tsx`
|
||||
|
||||
```tsx
|
||||
<InView>
|
||||
<motion.section
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } }
|
||||
}}
|
||||
>
|
||||
<motion.h2 variants={titleVariants}>Get In Touch</motion.h2>
|
||||
{/* Contact content */}
|
||||
</motion.section>
|
||||
</InView>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Reduced Motion
|
||||
|
||||
Motion library auto-handles `prefers-reduced-motion` khi config:
|
||||
|
||||
```tsx
|
||||
// Trong main.tsx hoặc app root
|
||||
import { motion, domMax } from "motion/react"
|
||||
|
||||
// Option 1: Global config
|
||||
motion.config.reducedMotion = "user"
|
||||
|
||||
// Option 2: Per-component
|
||||
<motion.div
|
||||
animate={{ x: 100 }}
|
||||
transition={{ type: "spring" }}
|
||||
reducedMotionConfig={{ type: "tween", duration: 0.3 }}
|
||||
/>
|
||||
```
|
||||
|
||||
**Effect:**
|
||||
- Enter animations: skip, hiển thị ngay
|
||||
- Scroll animations: hiển thị ngay khi in view
|
||||
- Gesture animations: vẫn hoạt động (hover/tap state)
|
||||
- Infinite animations (swaying): dừng lại
|
||||
|
||||
---
|
||||
|
||||
## CSS Changes
|
||||
|
||||
### Removed:
|
||||
- CSS `@keyframes` cho animations (nếu có)
|
||||
- CSS `animation` properties
|
||||
- CSS `prefers-reduced-motion` media queries (motion auto-handled)
|
||||
|
||||
### Added:
|
||||
- Chỉ layout/styling CSS (position, color, font, spacing)
|
||||
- Không có animation CSS
|
||||
|
||||
---
|
||||
|
||||
## Files Summary
|
||||
|
||||
| File | Action | Changes |
|
||||
|---|---|---|
|
||||
| `package.json` | Modify | Add `motion` dependency |
|
||||
| `src/components/ui/OpenToWorkBadge.tsx` | Rewrite | motion + SVG spring + hashtag |
|
||||
| `src/components/sections/Hero.tsx` | Modify | motion enter animations |
|
||||
| `src/components/ui/Button.tsx` | Modify | motion hover/tap |
|
||||
| `src/components/ui/InView.tsx` | **New** | Reusable scroll wrapper |
|
||||
| `src/components/sections/Expertise.tsx` | Modify | motion scroll + hover |
|
||||
| `src/components/sections/Experience.tsx` | Modify | motion scroll + hover |
|
||||
| `src/components/sections/Projects.tsx` | Modify | motion scroll + hover |
|
||||
| `src/components/sections/Contact.tsx` | Modify | motion scroll |
|
||||
| `src/main.tsx` | Modify | Set `motion.config.reducedMotion` |
|
||||
| `src/App.css` | Modify | Remove animation CSS, keep layout |
|
||||
|
||||
---
|
||||
|
||||
## Animation Timing Summary
|
||||
|
||||
| Element | Delay | Duration | Type |
|
||||
|---|---|---|---|
|
||||
| Hero container | 0s | 0.3s | fade |
|
||||
| Hero content | 0.2s | 0.6s | slide-left |
|
||||
| Hero name | 0.3s | 0.5s | slide-up |
|
||||
| Hero title | 0.4s | 0.5s | slide-up |
|
||||
| Hero tagline | 0.5s | 0.5s | slide-up |
|
||||
| Hero CTA | 0.6s | 0.5s | slide-up |
|
||||
| Hero visual | 0.4s | 0.6s | slide-right |
|
||||
| OTW badge | 0.3s | 0.5s | slide-down + fade |
|
||||
| Section titles | scroll | 0.5s | slide-up |
|
||||
| Cards/entries | scroll | 0.5s | slide-up + stagger |
|
||||
| Buttons/cards | hover | 0.2s | scale |
|
||||
@@ -0,0 +1,229 @@
|
||||
# UI Spec - Open to Work Badge (Redesign)
|
||||
|
||||
## Overview
|
||||
|
||||
Thay thế badge "Open to Work" hiện tại bằng badge dạng hashtag `#OpenToWork` với spring coil SVG phía sau và swaying animation, sử dụng motion library.
|
||||
|
||||
---
|
||||
|
||||
## Structure
|
||||
|
||||
```
|
||||
otw-container (motion.div, position absolute, góc trên-trái)
|
||||
├── otw-spring (SVG, spring coil, phía sau)
|
||||
│ └── path (motion.path, swaying)
|
||||
└── otw-badge (motion.div, hashtag text, phía trước)
|
||||
└── #OpenToWork (span)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Spring Coil SVG
|
||||
|
||||
### Design
|
||||
- Shape: lò xo xoắn 1.5 vòng (3 vòng bán) + tail
|
||||
- Stroke: `var(--accent)`, strokeWidth: 2, strokeLinecap: round
|
||||
- ViewBox: `0 0 60 120` (dọc)
|
||||
- Position: phía sau badge, offset một chút
|
||||
- Width: 40px, Height: 80px
|
||||
|
||||
### Path data
|
||||
|
||||
```
|
||||
M 30 0
|
||||
C 50 5, 50 15, 30 20
|
||||
C 10 25, 10 35, 30 40
|
||||
C 50 45, 50 55, 30 60
|
||||
C 10 65, 10 75, 30 80
|
||||
C 50 85, 50 95, 30 100
|
||||
C 10 105, 10 115, 30 120
|
||||
L 30 125
|
||||
```
|
||||
|
||||
### Animation (motion)
|
||||
|
||||
```tsx
|
||||
<motion.path
|
||||
d="M 30 0 C 50 5, 50 15, 30 20 C 10 25, 10 35, 30 40
|
||||
C 50 45, 50 55, 30 60 C 10 65, 10 75, 30 80
|
||||
C 50 85, 50 95, 30 100 C 10 105, 10 115, 30 120 L 30 125"
|
||||
stroke="var(--accent)"
|
||||
fill="none"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
animate={{ rotate: [-8, 8, -8] }}
|
||||
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
|
||||
/>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Badge
|
||||
|
||||
### Content
|
||||
- `#OpenToWork` (text duy nhất)
|
||||
- Font: monospace, bold, 20px
|
||||
- Color: `var(--accent)` (theme-aware, light/dark)
|
||||
- Background: transparent
|
||||
- Padding: 8px 16px
|
||||
- Border-radius: 8px
|
||||
|
||||
### Position
|
||||
- Góc trên-trái của `hero-visual`
|
||||
- Offset: top: 20px, left: 20px
|
||||
- Z-index: cao hơn spring
|
||||
|
||||
### Animation (motion)
|
||||
|
||||
```tsx
|
||||
<motion.div
|
||||
className="otw-badge"
|
||||
animate={{ rotate: [-8, 8, -8] }}
|
||||
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
|
||||
/>
|
||||
```
|
||||
|
||||
### Container animation (motion)
|
||||
|
||||
```tsx
|
||||
<motion.div
|
||||
className="otw-container"
|
||||
initial={{ opacity: 0, y: -20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: 0.3, duration: 0.5 }}
|
||||
/>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Swaying Animation
|
||||
|
||||
### Rotation oscillate
|
||||
- Range: `-8° → +8° → -8°`
|
||||
- Duration: 3s
|
||||
- Easing: ease-in-out
|
||||
- Repeat: Infinity
|
||||
- Transform-origin: top center (motion default)
|
||||
|
||||
### Reduced motion
|
||||
- `prefers-reduced-motion: reduce` → motion library auto-handles
|
||||
- Không cần CSS media query
|
||||
|
||||
---
|
||||
|
||||
## Responsive
|
||||
|
||||
### Desktop (>768px)
|
||||
- Badge: góc trên-trái hero-visual
|
||||
- Spring: phía sau badge
|
||||
- Font-size: 20px
|
||||
- Rotation: `-8° → +8°`
|
||||
|
||||
### Mobile (≤768px)
|
||||
- Badge: góc trên-trái hero section
|
||||
- Spring: phía sau badge
|
||||
- Font-size: 16px
|
||||
- Rotation: `-4° → +4°` (nhẹ hơn)
|
||||
- Position: top: 16px, left: 16px
|
||||
|
||||
---
|
||||
|
||||
## Component Implementation
|
||||
|
||||
### `src/components/ui/OpenToWorkBadge.tsx`
|
||||
|
||||
```tsx
|
||||
import { motion } from "motion/react"
|
||||
|
||||
export function OpenToWorkBadge() {
|
||||
return (
|
||||
<motion.div
|
||||
className="otw-container"
|
||||
initial={{ opacity: 0, y: -20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: 0.3, duration: 0.5 }}
|
||||
>
|
||||
<svg className="otw-spring" viewBox="0 0 60 120">
|
||||
<motion.path
|
||||
d="M 30 0 C 50 5, 50 15, 30 20 C 10 25, 10 35, 30 40
|
||||
C 50 45, 50 55, 30 60 C 10 65, 10 75, 30 80
|
||||
C 50 85, 50 95, 30 100 C 10 105, 10 115, 30 120 L 30 125"
|
||||
stroke="var(--accent)"
|
||||
fill="none"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
animate={{ rotate: [-8, 8, -8] }}
|
||||
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
|
||||
/>
|
||||
</svg>
|
||||
<motion.div
|
||||
className="otw-badge"
|
||||
animate={{ rotate: [-8, 8, -8] }}
|
||||
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
|
||||
>
|
||||
<span>#OpenToWork</span>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## CSS Changes
|
||||
|
||||
### Removed (from current):
|
||||
- `.otw-badge` current styles (bg, padding, shadow, etc.)
|
||||
- `.otw-icon` styles
|
||||
|
||||
### New CSS:
|
||||
|
||||
```css
|
||||
.otw-container {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.otw-spring {
|
||||
width: 40px;
|
||||
height: 80px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.otw-badge {
|
||||
font-family: monospace;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: var(--accent);
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media (max-width: 768px) {
|
||||
.otw-container {
|
||||
top: 16px;
|
||||
left: 16px;
|
||||
}
|
||||
.otw-badge {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Constraints
|
||||
|
||||
- Không hard-code màu — dùng CSS `var(--accent)`
|
||||
- Không che profile photo
|
||||
- SVG inline trong component (không file ngoài)
|
||||
- Accessibility: aria-label cho badge
|
||||
- Animation respects `prefers-reduced-motion` (motion library auto-handled)
|
||||
- Tất cả animations dùng motion library, không CSS keyframes
|
||||
@@ -10,6 +10,7 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"motion": "^14.0.0",
|
||||
"react": "^19.2.8",
|
||||
"react-dom": "^19.2.8",
|
||||
"react-router": "8.4.0"
|
||||
|
||||
Generated
+59
@@ -8,6 +8,9 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
motion:
|
||||
specifier: ^14.0.0
|
||||
version: 14.0.0(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
|
||||
react:
|
||||
specifier: ^19.2.8
|
||||
version: 19.3.0
|
||||
@@ -315,6 +318,17 @@ packages:
|
||||
picomatch:
|
||||
optional: true
|
||||
|
||||
framer-motion@14.0.0:
|
||||
resolution: {integrity: sha512-QAtHmybrDFSliyW1sexMtSQTQd+1jw2ajibEmzpuI4XdPVzQkn+dAzJMm2sW3pl9MJuSS4xN51djQ7huhlP/VA==}
|
||||
peerDependencies:
|
||||
react: ^18.0.0 || ^19.0.0
|
||||
react-dom: ^18.0.0 || ^19.0.0
|
||||
peerDependenciesMeta:
|
||||
react:
|
||||
optional: true
|
||||
react-dom:
|
||||
optional: true
|
||||
|
||||
fsevents@2.3.3:
|
||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
@@ -394,6 +408,23 @@ packages:
|
||||
resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
|
||||
motion-dom@14.0.0:
|
||||
resolution: {integrity: sha512-aU3ApXo1yTpeUi3JU+jbDk2TELjxPE3MbBMUP7nZHlARb6RweJK+ojmLjpuB0YsY6zhbBl1YWGo8LMsI1/Llqw==}
|
||||
|
||||
motion-utils@14.0.0:
|
||||
resolution: {integrity: sha512-jBsyjVxTTRZNeuvd/v+btVXr90LQkYl4HhRu9T2ARc+PMnvkmjsjRVeAg4Qm10b6TlTw+kykWI8gu/6LuvpLSQ==}
|
||||
|
||||
motion@14.0.0:
|
||||
resolution: {integrity: sha512-oGc2lkge2lkRZCP+J8/JsnYu4NFjqP1MtXirNdetn3QbvK2JqwM9A200EdT4C598KfzDhjLT12zF21xDM4Oilw==}
|
||||
peerDependencies:
|
||||
react: ^18.0.0 || ^19.0.0
|
||||
react-dom: ^18.0.0 || ^19.0.0
|
||||
peerDependenciesMeta:
|
||||
react:
|
||||
optional: true
|
||||
react-dom:
|
||||
optional: true
|
||||
|
||||
nanoid@3.3.19:
|
||||
resolution: {integrity: sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
@@ -458,6 +489,9 @@ packages:
|
||||
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
||||
tslib@2.8.1:
|
||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||
|
||||
typescript@6.0.3:
|
||||
resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
|
||||
engines: {node: '>=14.17'}
|
||||
@@ -646,6 +680,15 @@ snapshots:
|
||||
optionalDependencies:
|
||||
picomatch: 4.0.7
|
||||
|
||||
framer-motion@14.0.0(react-dom@19.3.0(react@19.3.0))(react@19.3.0):
|
||||
dependencies:
|
||||
motion-dom: 14.0.0
|
||||
motion-utils: 14.0.0
|
||||
tslib: 2.8.1
|
||||
optionalDependencies:
|
||||
react: 19.3.0
|
||||
react-dom: 19.3.0(react@19.3.0)
|
||||
|
||||
fsevents@2.3.3:
|
||||
optional: true
|
||||
|
||||
@@ -698,6 +741,20 @@ snapshots:
|
||||
lightningcss-win32-arm64-msvc: 1.33.0
|
||||
lightningcss-win32-x64-msvc: 1.33.0
|
||||
|
||||
motion-dom@14.0.0:
|
||||
dependencies:
|
||||
motion-utils: 14.0.0
|
||||
|
||||
motion-utils@14.0.0: {}
|
||||
|
||||
motion@14.0.0(react-dom@19.3.0(react@19.3.0))(react@19.3.0):
|
||||
dependencies:
|
||||
framer-motion: 14.0.0(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
|
||||
tslib: 2.8.1
|
||||
optionalDependencies:
|
||||
react: 19.3.0
|
||||
react-dom: 19.3.0(react@19.3.0)
|
||||
|
||||
nanoid@3.3.19: {}
|
||||
|
||||
oxlint@1.86.0:
|
||||
@@ -777,6 +834,8 @@ snapshots:
|
||||
fdir: 6.5.0(picomatch@4.0.7)
|
||||
picomatch: 4.0.7
|
||||
|
||||
tslib@2.8.1: {}
|
||||
|
||||
typescript@6.0.3: {}
|
||||
|
||||
undici-types@7.24.6: {}
|
||||
|
||||
+25
-31
@@ -200,6 +200,7 @@
|
||||
|
||||
.btn-primary:hover {
|
||||
background: var(--accent-hover);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-primary:active {
|
||||
@@ -415,37 +416,28 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
.otw-badge {
|
||||
.otw-container {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
max-width: 200px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.otw-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-bottom: 2px;
|
||||
.otw-spring {
|
||||
width: 40px;
|
||||
height: 80px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.otw-title {
|
||||
font-size: 18px;
|
||||
.otw-badge {
|
||||
font-family: monospace;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.otw-subtitle {
|
||||
font-size: 14px;
|
||||
opacity: 0.9;
|
||||
line-height: 1.3;
|
||||
color: var(--accent);
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@@ -475,12 +467,14 @@
|
||||
border-radius: 16px;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.otw-badge {
|
||||
bottom: 16px;
|
||||
right: 16px;
|
||||
padding: 16px;
|
||||
.otw-container {
|
||||
top: 16px;
|
||||
left: 16px;
|
||||
}
|
||||
.otw-badge {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ===== Expertise Grid ===== */
|
||||
|
||||
@@ -1,42 +1,104 @@
|
||||
import { DownloadResume } from '@/components/sections/DownloadResume'
|
||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { profile } from '@/data/profile'
|
||||
import { motion } from "motion/react"
|
||||
import { DownloadResume } from "@/components/sections/DownloadResume"
|
||||
import { SectionHeading } from "@/components/ui/SectionHeading"
|
||||
import { profile } from "@/data/profile"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
|
||||
export function Contact() {
|
||||
return (
|
||||
<section className="section container-content" aria-labelledby="contact-heading">
|
||||
<InView>
|
||||
<motion.section
|
||||
className="section container-content"
|
||||
aria-labelledby="contact-heading"
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
<SectionHeading title="Contact" />
|
||||
<div className="contact-links">
|
||||
<a href={`mailto:${profile.email}`} className="contact-link">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
|
||||
<motion.a
|
||||
href={`mailto:${profile.email}`}
|
||||
className="contact-link"
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
width="24"
|
||||
height="24"
|
||||
>
|
||||
<rect x="2" y="4" width="20" height="16" rx="2" />
|
||||
<path d="M22 4l-10 8L2 4" />
|
||||
</svg>
|
||||
<div>
|
||||
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>Email</div>
|
||||
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>{profile.email}</div>
|
||||
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
||||
Email
|
||||
</div>
|
||||
</a>
|
||||
<a href={profile.githubUrl} target="_blank" rel="noopener noreferrer" className="contact-link">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
|
||||
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
||||
{profile.email}
|
||||
</div>
|
||||
</div>
|
||||
</motion.a>
|
||||
<motion.a
|
||||
href={profile.githubUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="contact-link"
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
width="24"
|
||||
height="24"
|
||||
>
|
||||
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
|
||||
</svg>
|
||||
<div>
|
||||
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>GitHub</div>
|
||||
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>@yourusername</div>
|
||||
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
||||
GitHub
|
||||
</div>
|
||||
</a>
|
||||
<a href={profile.linkedinUrl} target="_blank" rel="noopener noreferrer" className="contact-link">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
|
||||
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
||||
@yourusername
|
||||
</div>
|
||||
</div>
|
||||
</motion.a>
|
||||
<motion.a
|
||||
href={profile.linkedinUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="contact-link"
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
width="24"
|
||||
height="24"
|
||||
>
|
||||
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
|
||||
</svg>
|
||||
<div>
|
||||
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>LinkedIn</div>
|
||||
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>Your Name</div>
|
||||
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
||||
LinkedIn
|
||||
</div>
|
||||
</a>
|
||||
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
||||
Your Name
|
||||
</div>
|
||||
</div>
|
||||
</motion.a>
|
||||
</div>
|
||||
<DownloadResume />
|
||||
</section>
|
||||
</motion.section>
|
||||
</InView>
|
||||
)
|
||||
}
|
||||
@@ -1,14 +1,50 @@
|
||||
import { experiences } from '@/data/experience'
|
||||
import { motion } from "motion/react"
|
||||
import { experiences } from "@/data/experience"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
|
||||
export function Experience() {
|
||||
return (
|
||||
<section className="section container-content" aria-labelledby="experience-heading">
|
||||
<h2 id="experience-heading" style={{ marginBottom: '48px' }}>
|
||||
<InView>
|
||||
<motion.section
|
||||
className="section container-content"
|
||||
aria-labelledby="experience-heading"
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: {
|
||||
opacity: 1,
|
||||
transition: { staggerChildren: 0.15 },
|
||||
},
|
||||
}}
|
||||
>
|
||||
<motion.h2
|
||||
id="experience-heading"
|
||||
style={{ marginBottom: "48px" }}
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: { opacity: 1, y: 0, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
Experience
|
||||
</h2>
|
||||
</motion.h2>
|
||||
<div className="timeline">
|
||||
{experiences.map((exp) => (
|
||||
<div key={exp.id} className="timeline-entry">
|
||||
{experiences.map((exp, i) => (
|
||||
<motion.div
|
||||
key={exp.id}
|
||||
className="timeline-entry"
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: {
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: { duration: 0.5, delay: i * 0.15 },
|
||||
},
|
||||
}}
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<div className="timeline-marker" />
|
||||
<div className="timeline-header">
|
||||
<div className="timeline-title">{exp.title}</div>
|
||||
@@ -25,13 +61,24 @@ export function Experience() {
|
||||
</ul>
|
||||
{exp.achievements?.map((achievement) => (
|
||||
<div key={achievement.id} className="achievement">
|
||||
<div className="achievement-title">{achievement.title}</div>
|
||||
<div className="achievement-context">{achievement.context}</div>
|
||||
<div style={{ fontSize: '14px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
|
||||
<div className="achievement-title">
|
||||
{achievement.title}
|
||||
</div>
|
||||
<div className="achievement-context">
|
||||
{achievement.context}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
fontSize: "14px",
|
||||
color: "var(--text-secondary)",
|
||||
marginBottom: "8px",
|
||||
}}
|
||||
>
|
||||
{achievement.impact}
|
||||
</div>
|
||||
{achievement.metrics && achievement.metrics.length > 0 && (
|
||||
<div style={{ marginBottom: '8px' }}>
|
||||
{achievement.metrics &&
|
||||
achievement.metrics.length > 0 && (
|
||||
<div style={{ marginBottom: "8px" }}>
|
||||
{achievement.metrics.map((m) => (
|
||||
<span key={m} className="achievement-metric">
|
||||
{m}
|
||||
@@ -48,9 +95,10 @@ export function Experience() {
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</motion.section>
|
||||
</InView>
|
||||
)
|
||||
}
|
||||
@@ -1,13 +1,42 @@
|
||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { skillGroups } from '@/data/skills'
|
||||
import { motion } from "motion/react"
|
||||
import { SectionHeading } from "@/components/ui/SectionHeading"
|
||||
import { skillGroups } from "@/data/skills"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
|
||||
export function Expertise() {
|
||||
return (
|
||||
<section className="section container-wide" aria-labelledby="expertise-heading">
|
||||
<InView>
|
||||
<motion.section
|
||||
className="section container-wide"
|
||||
aria-labelledby="expertise-heading"
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: {
|
||||
opacity: 1,
|
||||
transition: { staggerChildren: 0.1 },
|
||||
},
|
||||
}}
|
||||
>
|
||||
<SectionHeading title="Core Expertise" />
|
||||
<div className="expertise-grid">
|
||||
{skillGroups.map((group) => (
|
||||
<div key={group.title} className="expertise-card">
|
||||
{skillGroups.map((group, i) => (
|
||||
<motion.div
|
||||
key={group.title}
|
||||
className="expertise-card"
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: {
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: { duration: 0.5, delay: i * 0.1 },
|
||||
},
|
||||
}}
|
||||
whileHover={{ scale: 1.05, y: -2 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<h3>{group.title}</h3>
|
||||
<ul className="expertise-skills">
|
||||
{group.skills.map((skill) => (
|
||||
@@ -16,9 +45,10 @@ export function Expertise() {
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</motion.section>
|
||||
</InView>
|
||||
)
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
import { OpenToWorkBadge } from '@/components/ui/OpenToWorkBadge'
|
||||
import { resumeAvailable } from '@/data/resume'
|
||||
import { Button } from '@/components/ui/Button'
|
||||
import { SocialLinks } from '@/components/ui/SocialLinks'
|
||||
import { profile } from '@/data/profile'
|
||||
import { motion } from "motion/react"
|
||||
import { OpenToWorkBadge } from "@/components/ui/OpenToWorkBadge"
|
||||
import { resumeAvailable } from "@/data/resume"
|
||||
import { Button } from "@/components/ui/Button"
|
||||
import { SocialLinks } from "@/components/ui/SocialLinks"
|
||||
import { profile } from "@/data/profile"
|
||||
|
||||
const socialLinks = [
|
||||
{
|
||||
label: 'GitHub',
|
||||
label: "GitHub",
|
||||
href: profile.githubUrl,
|
||||
'aria-label': 'View GitHub profile',
|
||||
"aria-label": "View GitHub profile",
|
||||
icon: (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
|
||||
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
|
||||
@@ -16,9 +17,9 @@ const socialLinks = [
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'LinkedIn',
|
||||
label: "LinkedIn",
|
||||
href: profile.linkedinUrl,
|
||||
'aria-label': 'View LinkedIn profile',
|
||||
"aria-label": "View LinkedIn profile",
|
||||
icon: (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
|
||||
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
|
||||
@@ -26,9 +27,9 @@ const socialLinks = [
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Email',
|
||||
label: "Email",
|
||||
href: `mailto:${profile.email}`,
|
||||
'aria-label': 'Send email',
|
||||
"aria-label": "Send email",
|
||||
icon: (
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="20" height="20">
|
||||
<rect x="2" y="4" width="20" height="16" rx="2" />
|
||||
@@ -40,14 +41,50 @@ const socialLinks = [
|
||||
|
||||
export function Hero() {
|
||||
return (
|
||||
<section className="hero container-wide" aria-labelledby="hero-heading">
|
||||
<div className="hero-content">
|
||||
<h1 id="hero-heading" className="hero-name">
|
||||
<motion.section
|
||||
className="hero container-wide"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
transition={{ duration: 0.3 }}
|
||||
aria-labelledby="hero-heading"
|
||||
>
|
||||
<motion.div
|
||||
className="hero-content"
|
||||
initial={{ opacity: 0, x: -30 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
transition={{ duration: 0.6, delay: 0.2 }}
|
||||
>
|
||||
<motion.h1
|
||||
id="hero-heading"
|
||||
className="hero-name"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.3 }}
|
||||
>
|
||||
{profile.name}
|
||||
</h1>
|
||||
<p className="hero-title">{profile.title}</p>
|
||||
<p className="hero-tagline">{profile.tagline}</p>
|
||||
<div className="hero-cta">
|
||||
</motion.h1>
|
||||
<motion.p
|
||||
className="hero-title"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.4 }}
|
||||
>
|
||||
{profile.title}
|
||||
</motion.p>
|
||||
<motion.p
|
||||
className="hero-tagline"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.5 }}
|
||||
>
|
||||
{profile.tagline}
|
||||
</motion.p>
|
||||
<motion.div
|
||||
className="hero-cta"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.6 }}
|
||||
>
|
||||
<Button href="/projects" variant="primary">
|
||||
View Projects
|
||||
</Button>
|
||||
@@ -59,17 +96,22 @@ export function Hero() {
|
||||
<Button href="/contact" variant="secondary">
|
||||
Contact Me
|
||||
</Button>
|
||||
</div>
|
||||
</motion.div>
|
||||
<SocialLinks links={socialLinks} />
|
||||
</div>
|
||||
<div className="hero-visual">
|
||||
</motion.div>
|
||||
<motion.div
|
||||
className="hero-visual"
|
||||
initial={{ opacity: 0, x: 30 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
transition={{ duration: 0.6, delay: 0.4 }}
|
||||
>
|
||||
<img
|
||||
src="/profile-photo.webp"
|
||||
alt="Profile photo"
|
||||
className="hero-photo"
|
||||
/>
|
||||
<OpenToWorkBadge />
|
||||
</div>
|
||||
</section>
|
||||
</motion.div>
|
||||
</motion.section>
|
||||
)
|
||||
}
|
||||
@@ -1,32 +1,74 @@
|
||||
import { Badge } from '@/components/ui/Badge'
|
||||
import { projects } from '@/data/projects'
|
||||
import { motion } from "motion/react"
|
||||
import { Badge } from "@/components/ui/Badge"
|
||||
import { projects } from "@/data/projects"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
|
||||
const categoryLabels: Record<string, string> = {
|
||||
'software-engineering': 'Software Engineering',
|
||||
logistics: 'Logistics',
|
||||
'ai-ml': 'AI / ML',
|
||||
'computer-vision': 'Computer Vision',
|
||||
architecture: 'Architecture',
|
||||
experiment: 'Experiment',
|
||||
"software-engineering": "Software Engineering",
|
||||
logistics: "Logistics",
|
||||
"ai-ml": "AI / ML",
|
||||
"computer-vision": "Computer Vision",
|
||||
architecture: "Architecture",
|
||||
experiment: "Experiment",
|
||||
}
|
||||
|
||||
export function Projects() {
|
||||
const featured = projects.filter((p) => p.featured).slice(0, 4)
|
||||
|
||||
return (
|
||||
<section className="section container-wide" aria-labelledby="projects-heading">
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: '48px' }}>
|
||||
<InView>
|
||||
<motion.section
|
||||
className="section container-wide"
|
||||
aria-labelledby="projects-heading"
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={{
|
||||
hidden: { opacity: 0 },
|
||||
visible: {
|
||||
opacity: 1,
|
||||
transition: { staggerChildren: 0.1 },
|
||||
},
|
||||
}}
|
||||
>
|
||||
<motion.div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "baseline",
|
||||
marginBottom: "48px",
|
||||
}}
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: { opacity: 1, y: 0, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
<h2 id="projects-heading">Featured Projects</h2>
|
||||
<a href="/projects" style={{ fontSize: '14px', fontWeight: 500, color: 'var(--accent)' }}>
|
||||
<motion.a
|
||||
href="/projects"
|
||||
style={{ fontSize: "14px", fontWeight: 500, color: "var(--accent)" }}
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
>
|
||||
View All →
|
||||
</a>
|
||||
</div>
|
||||
</motion.a>
|
||||
</motion.div>
|
||||
<div className="projects-grid">
|
||||
{featured.map((project) => (
|
||||
<a
|
||||
{featured.map((project, i) => (
|
||||
<motion.a
|
||||
key={project.id}
|
||||
href={`/projects/${project.id}`}
|
||||
className="project-card"
|
||||
variants={{
|
||||
hidden: { opacity: 0, y: 30 },
|
||||
visible: {
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: { duration: 0.5, delay: i * 0.1 },
|
||||
},
|
||||
}}
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<div className="project-card-header">
|
||||
<h3>{project.title}</h3>
|
||||
@@ -52,9 +94,10 @@ export function Projects() {
|
||||
</div>
|
||||
)}
|
||||
<span className="project-card-cta">View Details →</span>
|
||||
</a>
|
||||
</motion.a>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</motion.section>
|
||||
</InView>
|
||||
)
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
import { forwardRef } from 'react'
|
||||
import type { ComponentPropsWithoutRef } from 'react'
|
||||
import { motion } from "motion/react"
|
||||
import { forwardRef } from "react"
|
||||
import type { ComponentPropsWithoutRef } from "react"
|
||||
|
||||
type ButtonVariant = 'primary' | 'secondary' | 'ghost'
|
||||
type ButtonSize = 'sm' | 'md' | 'lg'
|
||||
type ButtonVariant = "primary" | "secondary" | "ghost"
|
||||
type ButtonSize = "sm" | "md" | "lg"
|
||||
|
||||
interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
|
||||
interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||
variant?: ButtonVariant
|
||||
size?: ButtonSize
|
||||
href?: string
|
||||
@@ -13,36 +14,61 @@ interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
|
||||
}
|
||||
|
||||
const variantClasses: Record<ButtonVariant, string> = {
|
||||
primary: 'btn btn-primary',
|
||||
secondary: 'btn btn-secondary',
|
||||
ghost: 'btn btn-ghost',
|
||||
primary: "btn btn-primary",
|
||||
secondary: "btn btn-secondary",
|
||||
ghost: "btn btn-ghost",
|
||||
}
|
||||
|
||||
const sizeClasses: Record<ButtonSize, string> = {
|
||||
sm: 'btn-sm',
|
||||
md: '',
|
||||
lg: 'btn-lg',
|
||||
sm: "btn-sm",
|
||||
md: "",
|
||||
lg: "btn-lg",
|
||||
}
|
||||
|
||||
export const Button = forwardRef<
|
||||
HTMLButtonElement | HTMLAnchorElement,
|
||||
ButtonProps
|
||||
>(({ variant = 'primary', size = 'md', href, className = '', children, ...props }, ref) => {
|
||||
>(
|
||||
(
|
||||
{
|
||||
variant = "primary",
|
||||
size = "md",
|
||||
href,
|
||||
className = "",
|
||||
children,
|
||||
...props
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
const classes = `${variantClasses[variant]} ${sizeClasses[size]} ${className}`.trim()
|
||||
|
||||
if (href) {
|
||||
return (
|
||||
<a href={href} className={classes} ref={ref as React.Ref<HTMLAnchorElement>} {...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}>
|
||||
<motion.a
|
||||
href={href}
|
||||
className={classes}
|
||||
ref={ref as React.Ref<HTMLAnchorElement>}
|
||||
|
||||
whileTap={{ scale: 0.95 }}
|
||||
{...(props as Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof ButtonProps>)}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
</motion.a>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<button className={classes} ref={ref as React.Ref<HTMLButtonElement>} {...props}>
|
||||
{children}
|
||||
</button>
|
||||
)
|
||||
})
|
||||
<motion.button
|
||||
className={classes}
|
||||
ref={ref as React.Ref<HTMLButtonElement>}
|
||||
|
||||
Button.displayName = 'Button'
|
||||
whileTap={{ scale: 0.95 }}
|
||||
{...(props as Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonProps>)}
|
||||
>
|
||||
{children}
|
||||
</motion.button>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Button.displayName = "Button"
|
||||
@@ -0,0 +1,30 @@
|
||||
import { motion, type MotionProps } from "motion/react"
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
interface InViewProps extends Omit<MotionProps, "children"> {
|
||||
children: ReactNode
|
||||
delay?: number
|
||||
threshold?: number
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function InView({
|
||||
children,
|
||||
delay = 0,
|
||||
threshold = 0.1,
|
||||
className,
|
||||
...props
|
||||
}: InViewProps) {
|
||||
return (
|
||||
<motion.div
|
||||
className={className}
|
||||
initial={{ opacity: 0, y: 30 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: threshold }}
|
||||
transition={{ duration: 0.5, delay }}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
)
|
||||
}
|
||||
@@ -1,23 +1,33 @@
|
||||
import { profile } from '@/data/profile'
|
||||
import { motion } from "motion/react"
|
||||
|
||||
export function OpenToWorkBadge() {
|
||||
return (
|
||||
<div className="otw-badge" role="status" aria-label="Open to work">
|
||||
<svg
|
||||
className="otw-icon"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
width="16"
|
||||
height="16"
|
||||
<motion.div
|
||||
className="otw-container"
|
||||
initial={{ opacity: 0, y: -20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: 0.3, duration: 0.5 }}
|
||||
role="status"
|
||||
aria-label="Open to work"
|
||||
>
|
||||
<polyline points="20 6 9 17 4 12" />
|
||||
<svg className="otw-spring" viewBox="0 0 60 120">
|
||||
<motion.path
|
||||
d="M 30 0 C 50 5, 50 15, 30 20 C 10 25, 10 35, 30 40 C 50 45, 50 55, 30 60 C 10 65, 10 75, 30 80 C 50 85, 50 95, 30 100 C 10 105, 10 115, 30 120 L 30 125"
|
||||
stroke="var(--accent)"
|
||||
fill="none"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
animate={{ rotate: [-8, 8, -8] }}
|
||||
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
|
||||
/>
|
||||
</svg>
|
||||
<span className="otw-title">Open to Work</span>
|
||||
<span className="otw-subtitle">{profile.title}</span>
|
||||
</div>
|
||||
<motion.div
|
||||
className="otw-badge"
|
||||
animate={{ rotate: [-8, 8, -8] }}
|
||||
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
|
||||
>
|
||||
<span>#OpenToWork</span>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
)
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import { motion } from "motion/react"
|
||||
|
||||
interface SocialLink {
|
||||
label: string
|
||||
href: string
|
||||
icon: React.ReactNode
|
||||
'aria-label': string
|
||||
"aria-label": string
|
||||
}
|
||||
|
||||
interface SocialLinksProps {
|
||||
@@ -10,21 +12,23 @@ interface SocialLinksProps {
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function SocialLinks({ links, className = '' }: SocialLinksProps) {
|
||||
export function SocialLinks({ links, className = "" }: SocialLinksProps) {
|
||||
return (
|
||||
<div className={`social-links ${className}`}>
|
||||
{links.map((link) => (
|
||||
<a
|
||||
<motion.a
|
||||
key={link.label}
|
||||
href={link.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="social-link"
|
||||
aria-label={link['aria-label']}
|
||||
aria-label={link["aria-label"]}
|
||||
whileHover={{ scale: 1.1 }}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
>
|
||||
{link.icon}
|
||||
<span>{link.label}</span>
|
||||
</a>
|
||||
</motion.a>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import { motion } from 'motion/react'
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.tsx'
|
||||
|
||||
// motion v14 has motion.config for reducedMotion but TS types don't expose it
|
||||
const motionWithConfig = motion as any
|
||||
motionWithConfig.config.reducedMotion = 'user'
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
|
||||
Reference in new issue
Block a user