feat(motion): standardize animation recipes across sections and pages

- Replace the AnimatedSection wrapper with the per-section recipe: InView
  wrapping motion.section with initial="hidden" whileInView="visible" and
  viewport={{ once: true, amount: 0.1 }}; delete AnimatedSection.tsx
- Apply the item recipe (opacity/y 24, amount 0.2, delay i * 0.08) to timeline
  entries, philosophy/expertise/project cards, hero blocks, contact links and
  project-detail blocks
- Move transforms into motion: whileHover/whileTap on cards, links and Button;
  CSS :hover keeps only colour/border/shadow, and `transition: all` becomes an
  explicit property list so motion owns the transform
- Rebuild HeroParticles as perspective-projected depth tiers with scroll-linked
  transforms, no mask-image, plus a documented reduced-motion caveat
- Update AGENTS.md motion section and spec-v3-ui-enhancements /
  spec-v3-mobile-navigation progress notes
This commit is contained in:
dong.nguyen committed 2026-10-17 20:02:47 +07:00
1 parent ae4a5b9cca
commit 4387f889f5
18 files changed
+716 -321

No files matched your search

+4 -2
View File
@@ -78,7 +78,7 @@ src/
components/
layout/ — Layout.tsx, Navigation.tsx, MobileMenu.tsx, Footer.tsx, ThemePaletteMenu.tsx
sections/ — Hero, About, Expertise, Experience, Projects, Contact, HeroParticles, DownloadResume
ui/ — Badge, Button, SectionHeading, SocialLinks, Tag, Typewriter, AnimatedSection, InView, RollingTextLink, BackToTop
ui/ — Badge, Button, SectionHeading, SocialLinks, Tag, Typewriter, InView, RollingTextLink, BackToTop
index.ts — barrel export
data/ — profile, skills, experience, projects, resume, palettes, navigation, social (TS modules)
hooks/ — useTheme.tsx, useLanguage.tsx, useClickOutside.ts
@@ -89,7 +89,9 @@ src/
## Motion & Animation
- `motion/react` v14 — ESM-first entrypoint (NOT `framer-motion`)
- `AnimatedSection.tsx` — scroll-triggered motion animation wrapper
- Section entrance recipe — every section (`Hero`, `About`, `Expertise`, `Experience`, `Projects`, `Contact`) and every standalone page: `InView` wrapping a `motion.section` with `initial="hidden" whileInView="visible"`, `viewport={{ once: true, amount: 0.1 }}` and `variants` `hidden: { opacity: 0 }` / `visible: { opacity: 1, transition: { duration: 0.5 } }`
- Item recipe (timeline entries, philosophy/expertise/project cards, hero content blocks, contact links, project-detail blocks): `motion.*` with `initial={{ opacity: 0, y: 24 }}`, `whileInView={{ opacity: 1, y: 0 }}`, `viewport={{ once: true, amount: 0.2 }}`, `transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}`
- Hover/press recipe — motion owns the transform, CSS `:hover` only colour/border/shadow: cards and links (`.project-card`, `.expertise-card`, `.philosophy-card`, `.contact-link`) use `whileHover={{ scale: 1.02, y: -4 }}` + `whileTap={{ scale: 0.98 }}`; `Button` uses `whileHover={{ y: -2 }}` + `whileTap={{ scale: 0.95 }}`; `.social-link` tiles use `scale: 1.1` / `0.9`. A motion-animated element never carries a CSS `transform` or `transition: all`
- `InView.tsx` — viewport intersection observer motion component
- `RollingTextLink.tsx` — animated text-scrolling navigation link
- `BackToTop.tsx` — scroll-to-top floating button with AnimatePresence
@@ -183,7 +183,7 @@ Per the owner's answer, the sheet reuses the footer's icon-only 48×48 tiles (`s
| Effect | Implementation | Cost / risk |
|---|---|---|
| Sheet enter **and** exit | `AnimatePresence` + `motion.div`, `opacity 0→1`, `y -12→0`, 220ms, `ease [0.25, 0.1, 0.25, 1]` (the curve already used in `AnimatedSection.tsx:31`) | Replaces `@keyframes slideIn` (`src/App.css:143-152`), deleted. Conditional mount also fixes D4 |
| Sheet enter **and** exit | `AnimatePresence` + `motion.div`, `opacity 0→1`, `y -12→0`, 220ms, `ease [0.25, 0.1, 0.25, 1]` (declared inline at `MobileMenu.tsx:38`) | Replaces `@keyframes slideIn` (`src/App.css:143-152`), deleted. Conditional mount also fixes D4 |
| Staggered rows | each nav row is a `motion.li` with `opacity 0→1`, `y 8→0`, `delay 0.05 + index * 0.04` | 6 rows finish at 0.33s. `motion.config.reducedMotion = 'user'` (`main.tsx:9`) strips transforms for reduce-users; `useReducedMotion()` zeroes the delays |
| Group blocks | the Appearance and Connect groups fade with the panel, no separate stagger | Deliberate: staggering 3 groups too would push the total reveal past 0.5s |
| Row press feedback | CSS only: `:hover` / `:active` → `background: var(--bg-elevated)` | No JS, no per-row motion cost |
+170 -112
View File
@@ -25,12 +25,17 @@ Enhance the portfolio UI with visual effects inspired by modern developer portfo
| 6 | Hero: floating particles | ✅ Done | `HeroParticles.tsx`, `Hero.tsx`, `App.css` |
| 7 | Hero: scroll indicator | ✅ Done | `Hero.tsx`, `App.css` |
| 8 | Button: gradient + outline + icon slide | ✅ Done | `Button.tsx`, `App.css` |
| 9 | Scroll animations: AnimatedSection | ✅ Done | `AnimatedSection.tsx`, `AboutPage.tsx` |
| 9 | Scroll animations: section + item entrance recipe | ✅ Done | `Hero.tsx`, `About.tsx`, `AboutPage.tsx`, `Experience.tsx`, `Expertise.tsx`, `Projects.tsx`, `Contact.tsx` |
| 10 | Logo: bracket format | ✅ Done | `Navigation.tsx`, `App.css` |
| 11 | Build + verify | ✅ Done | type-check + lint pass (build locked by dev server) |
| 12 | Download resume: click outside to close | ✅ Done | `DownloadResume.tsx`, `Hero.tsx`, `App.css`, `hooks/useClickOutside.ts` |
| 13 | Download resume: FontAwesome-style icon | ✅ Done | `DownloadResume.tsx`, `Hero.tsx` |
| 14 | Mobile: hero section responsive fixes | ✅ Done | `App.css` |
| 15 | Hero particles: reduced-motion fallback (iPadOS) | ✅ Done | `App.css` |
| 16 | Hero particles: 3D depth tiers + scroll parallax | ✅ Done | `HeroParticles.tsx`, `App.css` |
| 17 | Animation consistency: hero + about match the Experience recipe | ✅ Done | `Hero.tsx`, `About.tsx`, `AboutPage.tsx`, `AnimatedSection.tsx` (deleted) |
| 18 | Animation consistency: every page and section on the same recipe | ✅ Done | `Expertise.tsx`, `Projects.tsx`, `Contact.tsx`, `ExperiencePage.tsx`, `ProjectsListPage.tsx`, `ProjectDetailPage.tsx`, `PhilosophyPage.tsx`, `ContactPage.tsx` |
| 19 | Hover + press feedback unified (motion owns the transform) | ✅ Done | `Button.tsx`, `Expertise.tsx`, `Contact.tsx`, `About.tsx`, `AboutPage.tsx`, `Projects.tsx`, `ProjectsListPage.tsx`, `ContactPage.tsx`, `App.css` |
---
## Prerequisites (Type/Data Changes)
@@ -232,79 +237,111 @@ interface TypewriterProps {
### 1.4 Floating Particles
**Effect:** Small dots floating upward in the hero background (30 desktop, 15 mobile).
**Effect:** Dots rising through a perspective-projected depth field — three tiers (far / mid / near), 30 dots desktop, 15 mobile.
**Implementation:**
- New component: `src/components/sections/HeroParticles.tsx`
- Creates `div.hero-particle` elements via `useMemo` (stable, no re-renders)
- Each particle has random: `left` position, `animationDuration` (8–18s), `animationDelay` (0–10s), `width` (2–5px)
- Animation: `float-particle` keyframes (translateY 100vh → -100px, scale 0 → 1)
- Color: `var(--accent)`
- Three `DepthTier` records (`FAR`, `MID`, `NEAR`) hold every per-tier constant; the component renders one `motion.div.hero-particle-layer--<id>` per tier
- Each tier declares its own `perspective: 700px`, so its dots are direct children of a perspective-declaring element and get genuine projection — `transform-style: preserve-3d` is used nowhere
- `translateZ` runs from deep towards the viewer, so a dot grows *and* fans out away from the vanishing point (`perspective-origin: 50% 78%`); hand-applied `scale()` cannot produce that lateral fan, which is why the old flat version read as "dots sliding up" rather than "dots floating in space"
- `--p-from` / `--p-to` are raw translateY offsets tuned per tier so that after projection every tier crosses the full hero box; equal projected distance with a longer `animation-duration` is what makes the far tier read as slower
- `--p-drift` sweeps each dot sideways across the cycle (opposite sign at 0% and 100%), so no path is a straight vertical line
- `animation-delay` is negative: every cycle is already in progress at mount, so the hero is populated at once instead of filling in over 10s
- Scroll parallax: three `useTransform(scrollY, [0, 500], [0, -30 | -60 | -100])`, one per layer — the near tier moves fastest
- Depth cue for the closest tier is `box-shadow: 0 0 10px var(--accent-glow)`. No `filter: blur()` and no `mask-image` on the container: both pull the animated dots into one re-rasterized group every frame, which is the main takedown risk on iPad
- Color `var(--accent)`; per-dot opacity jitter 0.75–1.10 × the tier opacity. Dot count stays 30 / 15 — the 3D pass adds a transform axis, not more elements
| Tier | `translateZ` | Projected scale | Size | Opacity | Duration | Drift | Desktop / Mobile |
|---|---|---|---|---|---|---|---|
| far | -500 → -180px | 0.58x → 0.80x | 6–9px → 3.5–7.2px projected | 0.22 | 16–24s | ±14px | 12 / 6 |
| mid | -300 → -60px | 0.70x → 0.92x | 7–11px → 4.9–10.1px projected | 0.45 | 11–17s | ±26px | 12 / 6 |
| near | -120 → +120px | 0.85x → 1.21x | 7–12px → 6.0–14.5px projected | 0.80 | 7–11s | ±40px | 6 / 3 |
**CSS:**
```css
.hero-particles {
.hero-particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
/* perspective lives on the layer: overflow: hidden on .hero-particles forces its used
transform-style to flat, so a perspective declared there projects only the three
layers and never the dots. */
.hero-particle-layer {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
perspective: 700px;
perspective-origin: 50% 78%;
}
.hero-particle {
position: absolute;
width: 4px;
height: 4px;
background: var(--accent);
border-radius: 50%;
opacity: 0.3;
opacity: 0;
animation: float-particle linear infinite;
}
.hero-particle-layer--near .hero-particle { box-shadow: 0 0 10px var(--accent-glow); }
@keyframes float-particle {
0% { transform: translateY(100vh) scale(0); opacity: 0; }
10% { opacity: 0.3; }
90% { opacity: 0.3; }
100% { transform: translateY(-100px) scale(1); opacity: 0; }
0% { transform: translate3d(var(--p-drift), var(--p-from), var(--p-z0)); opacity: 0; }
12% { opacity: var(--p-op); }
88% { opacity: var(--p-op); }
100% { transform: translate3d(calc(var(--p-drift) * -1), var(--p-to), var(--p-z1)); opacity: 0; }
}
```
**Reduced motion (iPadOS / Safari):**
`.hero-particle` declares `animation: float-particle linear infinite`, so `animation-fill-mode` is `none`. The global reduced-motion rule in `src/index.css` clamps `animation-duration` to `0.01ms` with `animation-iteration-count: 1`, which ends the animation instantly and returns each dot to its unanimated style: `opacity` restored, no transform, `top: auto` — the static position at the top edge of `.hero-particles`. All dots then stack inside the hero's first 16px, behind `.nav` (`position: fixed; top: 0; z-index: 1000`), so the layer reads as missing. iPadOS exposes this as Settings → Accessibility → Motion → Reduce Motion, which Safari reports as `prefers-reduced-motion: reduce`.
Fix: hide the decorative layer instead of freezing it, in the existing reduced-motion block of `src/App.css` (same convention as `.download-resume-lazer-border`):
```css
@media (prefers-reduced-motion: reduce) {
.hero-particles {
display: none;
}
}
```
Not a viewport problem: no media query hides `.hero-particles`, and `window.innerWidth < 768` only picks 15 vs 30 dots — iPad Pro (834 / 1024 / 1210 / 1366) always takes 30.
**HeroParticles.tsx:**
```tsx
const FAR: DepthTier = { z: [-500, -180], from: 121, to: -29, size: [6, 9], opacity: 0.22, duration: [16, 24], drift: 14, counts: { desktop: 12, mobile: 6 }, scrollShift: -30 }
const MID: DepthTier = { z: [-300, -60], from: 114, to: -14, size: [7, 11], opacity: 0.45, duration: [11, 17], drift: 26, counts: { desktop: 12, mobile: 6 }, scrollShift: -60 }
const NEAR: DepthTier = { z: [-120, 120], from: 103, to: 17, size: [7, 12], opacity: 0.8, duration: [7, 11], drift: 40, counts: { desktop: 6, mobile: 3 }, scrollShift: -100 }
export function HeroParticles() {
const count = typeof window !== 'undefined' && window.innerWidth < 768 ? 15 : 30
const particles = useMemo(() =>
Array.from({ length: count }, (_, i) => ({
id: i,
left: `${Math.random() * 100}%`,
duration: `${Math.random() * 10 + 8}s`,
delay: `${Math.random() * 10}s`,
size: `${Math.random() * 3 + 2}px`,
})),
[count]
const isMobile = typeof window !== 'undefined' && window.innerWidth < 768
const { scrollY } = useScroll()
const layerY = {
far: useTransform(scrollY, SCROLL_RANGE, [0, FAR.scrollShift]),
mid: useTransform(scrollY, SCROLL_RANGE, [0, MID.scrollShift]),
near: useTransform(scrollY, SCROLL_RANGE, [0, NEAR.scrollShift]),
}
const layers = useMemo(
() => depthTiers.map(tier => ({ tier, particles: createParticles(tier, isMobile ? tier.counts.mobile : tier.counts.desktop) })),
[isMobile],
)
return (
<div className="hero-particles" aria-hidden="true">
{layers.map(({ tier, particles }) => (
<motion.div key={tier.id} className={`hero-particle-layer hero-particle-layer--${tier.id}`} style={{ y: layerY[tier.id] }}>
{particles.map(p => (
<div
key={p.id}
className="hero-particle"
style={{
left: p.left,
width: p.size,
height: p.size,
animationDuration: p.duration,
animationDelay: p.delay,
}}
/>
<div key={p.id} className="hero-particle" style={particleStyle(p, tier)} />
))}
</motion.div>
))}
</div>
)
}
// particleStyle(p, tier) emits left / width / height / animationDuration / a negative
// animationDelay, plus --p-from, --p-to, --p-z0, --p-z1, --p-drift and --p-op.
```
**Files:**
- `src/components/sections/HeroParticles.tsx` (new)
- `src/components/sections/Hero.tsx`
- `src/index.css`
- `src/components/sections/HeroParticles.tsx` (created here; rewritten for the depth tiers)
- `src/components/sections/Hero.tsx` (mounts `<HeroParticles/>`; untouched by the 3D pass — the component owns its own `useScroll`)
- `src/App.css` (`.hero-particles`, `.hero-particle-layer`, `.hero-particle`, `@keyframes float-particle`, reduced-motion block)
---
@@ -596,87 +633,103 @@ export function SectionHeading({ title, subtitle, tag, id }: SectionHeadingProps
## 4. Scroll Animations
### 4.1 Unified Animation Wrapper
### 4.1 Unified Section Entrance
**Effect:** Sections animate in on scroll with configurable direction and delay.
**Effect:** Every section enters the same way: a scroll-triggered fade on the section, then its items rising one by one.
**Current state:**
- Expertise, Experience, Projects, Contact: `whileInView` fade-in + slide-up (via `motion.section`)
- Hero: `InView` + initial fade-in (no scroll trigger for entrance)
- About: no animation
**State before the consistency passes:**
- Experience: `motion.section` + staggered timeline entries — the reference
- Expertise, Projects: `motion.section` with cards on `variants` (`y: 30`) driven by **both** `staggerChildren: 0.1` and `delay: i * 0.1` — the stagger was applied twice
- Contact: `motion.section` whose links had hover/tap only, no entrance
- Hero: `InView` plus mount-time `animate` (no scroll trigger), `.hero-content` sliding in from `x: -30`, hand-written delays 0.15–0.6 — three overlapping fades on the same subtree
- About (homepage): bare `<section>` inside `<InView>` — no section animation, no item animation
- AboutPage: `AnimatedSection` nested inside `InView`, with its own distance (40px), duration (0.6s) and cubic-bezier — no item animation
- ExperiencePage: staggered entries but no `InView` wrapper; ProjectsListPage, ProjectDetailPage, PhilosophyPage, ContactPage: no animation at all
**Implementation:**
- New component: `src/components/ui/AnimatedSection.tsx`
- Wraps children in `motion.div` with `whileInView` animation
- Accepts `direction` prop: `'up' | 'right' | 'left'`
- Accepts `delay` prop for staggered children
- Uses `InView` for scroll-triggered rendering
**Implementation (the two recipes every section now uses):**
- Section: `InView` wrapping `motion.section` with `initial="hidden" whileInView="visible"`, `viewport={{ once: true, amount: 0.1 }}` and `variants={{ hidden: { opacity: 0 }, visible: { opacity: 1, transition: { duration: 0.5 } } }}`
- Item: `motion.*` with `initial={{ opacity: 0, y: 24 }}`, `whileInView={{ opacity: 1, y: 0 }}`, `viewport={{ once: true, amount: 0.2 }}`, `transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}`
- Items animate individually rather than through `staggerChildren`. `Expertise.tsx` and `Projects.tsx` were moved off `variants` + `staggerChildren: 0.1` at `y: 30`; their `whileHover` / `whileTap` behaviour is untouched
- `AnimatedSection.tsx` is gone: its only consumer was `AboutPage`, and its `direction` / `delay` props were never passed
**Props:**
**Recipe:**
```tsx
interface AnimatedSectionProps {
direction?: 'up' | 'right' | 'left'
delay?: number
children: ReactNode
}
```
**AnimatedSection.tsx:**
```tsx
import { motion } from "motion/react"
import { InView } from "@/components/ui/InView"
const directions = {
up: { y: [40, 0], opacity: [0, 1] },
right: { x: [-40, 0], opacity: [0, 1] },
left: { x: [40, 0], opacity: [0, 1] },
}
export function AnimatedSection({
direction = 'up',
delay = 0,
children,
}: AnimatedSectionProps) {
const { y, opacity } = directions[direction]
return (
<InView>
<motion.div
initial={{ y, opacity }}
whileInView={{ y: 0, opacity: 1 }}
viewport={{ once: true, margin: "0px 0px -50px 0px" }}
transition={{ duration: 0.6, delay, ease: [0.25, 0.1, 0.25, 1] }}
<InView>
<motion.section
className="section container-wide"
initial="hidden" whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={{ hidden: { opacity: 0 }, visible: { opacity: 1, transition: { duration: 0.5 } } }}
>
{children}
</motion.div>
</InView>
)
}
<motion.div className="philosophy-card"
initial={{ opacity: 0, y: 24 }} whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }} />
</motion.section>
</InView>
```
**Usage:**
**Hero specifics:** `Hero.tsx:38-48` carries the section recipe. `.hero-content` (`Hero.tsx:54`) is a plain `div`: the greeting, name, title, tagline and CTA each carry the item recipe with `delay: 0 / 0.08 / 0.16 / 0.24 / 0.32`, and `.hero-visual` rises with `delay: 0.4`. The scroll parallax moved from `.hero-visual` to `.hero-photo` (`motion.img style={{ y }}`) — a `MotionValue` bound to `y` and an animated `y` on the same element collide, so parallax and entrance now live on different elements.
**Coverage after the sweep:**
| File | Section recipe | Items carrying the item recipe |
|---|---|---|
| `Hero.tsx` | ✓ | greeting, `h1`, title, tagline, CTA, visual — delays 0 → 0.4 |
| `About.tsx` | ✓ | 3 philosophy cards |
| `Expertise.tsx` | ✓ | skill-group cards |
| `Experience.tsx` | ✓ | timeline entries (the reference) |
| `Projects.tsx` | ✓ | featured project cards |
| `Contact.tsx` | ✓ | 3 contact links — delays 0 / 0.08 / 0.16 |
| `AboutPage.tsx` | ✓ ×2 | philosophy cards, expertise cards |
| `ExperiencePage.tsx` | ✓ | timeline entries |
| `ProjectsListPage.tsx` | ✓ | project cards |
| `ProjectDetailPage.tsx` | ✓ ×2 (found + not-found) | title row, lede, impact, role, technologies, experiment heading (0 → 0.4) then entries at `0.48 + idx * 0.08` |
| `PhilosophyPage.tsx` | ✓ | quotes |
| `ContactPage.tsx` | ✓ | 3 contact links — delays 0 / 0.08 / 0.16 |
`HomePage.tsx` composes the six homepage sections and needs nothing of its own.
**Files — hero + about pass:**
- `src/components/sections/Hero.tsx` (section recipe + per-item entrance; parallax moved to `.hero-photo`)
- `src/components/sections/About.tsx` (`motion.section` + staggered philosophy cards)
- `src/pages/AboutPage.tsx` (`AnimatedSection` → `InView` + `motion.section`, staggered cards in both sections)
- `src/components/ui/AnimatedSection.tsx` (deleted)
- `AGENTS.md` (Motion & Animation now records the two recipes)
**Files — rest of the site:**
- `src/components/sections/Expertise.tsx` (cards moved off `variants` + `staggerChildren`)
- `src/components/sections/Projects.tsx` (same)
- `src/components/sections/Contact.tsx` (3 contact links gained the item recipe, delays 0 / 0.08 / 0.16)
- `src/pages/ExperiencePage.tsx` (bare `<section>` → `InView` + `motion.section`)
- `src/pages/ProjectsListPage.tsx` (`Link` → `MotionLink`, section + item recipe)
- `src/pages/ProjectDetailPage.tsx` (section recipe on both branches; title row, lede, impact, role, technologies, experiment heading and entries as items; shared `itemTransition(delay): Transition` helper)
- `src/pages/PhilosophyPage.tsx` (section recipe + staggered quotes)
- `src/pages/ContactPage.tsx` (`<a>` → `motion.a`, section + item recipe)
### 4.2 Hover and Press Feedback
**Rule:** motion owns the transform; CSS `:hover` owns colour, border and shadow only. A CSS `transform` on a `motion.*` element is dead as soon as motion writes its inline transform, and a CSS `transition: all` on that element re-times motion's own per-frame updates. Both patterns were removed.
**Card / link recipe** — `.project-card`, `.expertise-card`, `.philosophy-card`, `.contact-link`:
```tsx
// AboutPage.tsx
<AnimatedSection>
<section className="section container-content" ...>
{/* content */}
</section>
</AnimatedSection>
// Expertise.tsx (replace existing motion.section)
<AnimatedSection direction="up" delay={0.1}>
<section className="section container-wide" ...>
{/* content */}
</section>
</AnimatedSection>
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
```
**Files:**
- `src/components/ui/AnimatedSection.tsx` (new)
- `src/pages/AboutPage.tsx` (wrap with AnimatedSection)
- `src/components/sections/Expertise.tsx` (replace motion.section)
- `src/pages/ExperiencePage.tsx` (replace motion.section)
- `src/pages/ProjectsListPage.tsx` (replace motion.section)
- `src/pages/ContactPage.tsx` (replace motion.section)
**Button recipe** — `.btn-primary`, `.btn-secondary`, `.btn-ghost`:
```tsx
whileHover={{ y: -2 }}
whileTap={{ scale: 0.95 }}
```
**Icon tile recipe** — `.social-link`: `whileHover={{ scale: 1.1 }}`, `whileTap={{ scale: 0.9 }}`. A 44px tile needs a larger scale than a card for the change to read as feedback.
Hover and press never fight: motion's `variantPriorityOrder` is `animate, whileInView, whileFocus, whileHover, whileTap, whileDrag, exit`, so `whileTap` outranks `whileHover` on `scale` while the hover `y` offset survives. `whileHover` also outranks the entrance's `whileInView` for `y`, and falls back to `y: 0` when the pointer leaves.
**CSS removed** (`src/App.css`): the `transform` line in `.btn-primary:hover`, `.btn-primary:active`, `.btn-secondary:hover`, `.social-link:hover`, `.project-card:hover`, `.contact-link:hover`; the whole `.btn-secondary:active` rule (transform was its only declaration); the `.back-to-top.visible` block plus `opacity: 0` and `transform: translateY(10px)` on `.back-to-top` — that button is mounted and unmounted by `AnimatePresence`, so `.visible` is never rendered. `transition: all` was narrowed to the properties each rule actually animates: `.btn`, `.social-link`, `.expertise-card`, `.project-card`, `.philosophy-card`, `.contact-link`, `.back-to-top`.
**Files:** `Button.tsx`, `Expertise.tsx`, `Contact.tsx`, `About.tsx`, `AboutPage.tsx`, `Projects.tsx`, `ProjectsListPage.tsx`, `ContactPage.tsx`, `App.css`. `SocialLinks.tsx` keeps its tile values; `DownloadResume.tsx` is a plain `<details>` with no motion, so its CSS hover is untouched.
---
@@ -997,7 +1050,7 @@ function DownloadDropdown() {
| 6 | Hero: floating particles | — | 15m |
| 7 | Hero: scroll indicator | — | 10m |
| 8 | Button: gradient + outline + icon slide | — | 10m |
| 9 | Scroll animations: AnimatedSection | — | 20m |
| 9 | Scroll animations: entrance recipe | — | 20m |
| 10 | Logo: bracket format | Step 0 | 5m |
| 11 | Build + verify | All | 10m |
| 12 | Download resume: click outside to close | — | 15m |
@@ -1041,3 +1094,8 @@ function DownloadDropdown() {
21. [ ] Scroll indicator visible and centered on mobile
22. [ ] Social links centered on mobile
23. [ ] All hero text (greeting, title, tagline, social links) visible in both dark/light modes on mobile
24. [ ] Hero particle layer is hidden (not frozen at the hero top edge) when `prefers-reduced-motion: reduce` matches — verify on iPad with Settings → Accessibility → Motion → Reduce Motion
25. [ ] Particle field reads as depth: the near tier is larger, faster and sweeps wider than the far tier, and its scroll parallax is the strongest — verify on iPad Pro with Reduce Motion off
26. [ ] Hero content, homepage About and AboutPage animate with the same recipe as Experience: section fade 0.5s, items `y: 24 → 0` at 0.45s `easeOut` with `delay: i * 0.08`; no nested animation wrapper remains
27. [ ] Every section and every standalone page uses the same entrance recipe: section fade 0.5s, items `y: 24 → 0` at 0.45s `easeOut` on a 0.08 delay ladder — no `staggerChildren`, no `y: 30`, no mount-time `animate` left anywhere
28. [ ] Hover and press feedback is uniform: every card and contact link lifts 4px with `scale: 1.02` on hover and `scale: 0.98` on press, buttons lift 2px with `scale: 0.95` on press, social tiles `1.1` / `0.9` — and no CSS `:hover` transform or `transition: all` remains on a motion-animated element
+50 -29
View File
@@ -450,7 +450,7 @@
border-radius: var(--radius-md);
cursor: pointer;
text-decoration: none;
transition: all var(--transition-fast);
transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
border: none;
}
@@ -469,12 +469,10 @@
.btn-primary:hover {
background: var(--accent-solid-hover);
color: var(--text-on-accent-solid);
transform: translateY(-2px);
box-shadow: 0 8px 30px var(--accent-glow);
}
.btn-primary:active {
background: var(--accent-solid-active);
transform: translateY(0);
box-shadow: 0 2px 10px var(--accent-glow);
}
@@ -488,10 +486,6 @@
.btn-secondary:hover {
border-color: var(--accent);
background: var(--accent-soft);
transform: translateY(-2px);
}
.btn-secondary:active {
transform: translateY(0);
}
.btn-icon {
@@ -611,12 +605,11 @@
border: 1.5px solid var(--border-strong);
border-radius: 6px;
color: var(--text-primary);
transition: color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
transition: color var(--transition-fast), border-color var(--transition-fast);
}
.social-link:hover {
border-color: var(--accent);
color: var(--accent);
transform: translateY(-3px);
}
.social-link:focus-visible {
outline: 2px solid var(--accent);
@@ -758,26 +751,52 @@
50% { opacity: 0; }
}
/* No mask-image on .hero-particles on purpose: a mask pulls the animated children into
one re-rasterized group, the same cost as filter: blur(). The 12% / 88% opacity ramp in
float-particle dissolves each dot before it reaches the clip edge, so the edges need no
extra softening. */
.hero-particles {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
}
/* One layer per depth tier. `perspective` belongs on the layer, not on
.hero-particles: overflow: hidden on the container forces its used transform-style
to flat, so a perspective declared there would project only the three layers and
never the particles. Clipping stays on the container. */
.hero-particle-layer {
position: absolute;
inset: 0;
perspective: 700px;
perspective-origin: 50% 78%;
}
.hero-particle {
position: absolute;
width: 4px;
height: 4px;
background: var(--accent);
border-radius: 50%;
opacity: 0.8;
opacity: 0;
animation: float-particle linear infinite;
}
/* Depth cue for the tier closest to the viewer. box-shadow, not filter: blur() —
animating children inside a filtered container re-rasterizes the whole layer every
frame, which is the main takedown risk on iPad. 6 particles; --accent-glow is
declared in all five blocks of index.css. */
.hero-particle-layer--near .hero-particle {
box-shadow: 0 0 10px var(--accent-glow);
}
/* --p-from / --p-to are raw translateY offsets from the top of the layer, tuned per
tier so that after projection (700px, origin 50% 78%) every tier crosses the full
hero box: far z -500 -> -180 projects 0.58x -> 0.80x, mid 0.70x -> 0.92x, near
z -120 -> +120 projects 0.85x -> 1.21x. Equal projected distance with a longer
duration is what makes the far tier read as slower. vh, not dvh: dvh re-resolves
when iOS Safari collapses its toolbar mid-cycle and the whole field jumps. */
@keyframes float-particle {
0% { transform: translateY(100vh) scale(0); opacity: 0; }
10% { opacity: 0.8; }
90% { opacity: 0.8; }
100% { transform: translateY(-100px) scale(1); opacity: 0; }
0% { transform: translate3d(var(--p-drift), var(--p-from), var(--p-z0)); opacity: 0; }
12% { opacity: var(--p-op); }
88% { opacity: var(--p-op); }
100% { transform: translate3d(calc(var(--p-drift) * -1), var(--p-to), var(--p-z1)); opacity: 0; }
}
.scroll-indicator {
@@ -1072,6 +1091,16 @@
.download-resume-lazer-glow {
animation: none;
}
/* Hero particles have no reduced-motion fallback: `.hero-particle` uses the
`animation` shorthand, so animation-fill-mode is `none`. The global clamp in
src/index.css (animation-duration: 0.01ms, animation-iteration-count: 1) ends
`float-particle` instantly and returns every dot to its unanimated style — no
transform, `top: auto` — stacking all of them at the top edge of
`.hero-particles`, behind the fixed nav. Hide the decorative layer instead. */
.hero-particles {
display: none;
}
}
@@ -1117,7 +1146,7 @@
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 24px;
transition: all var(--transition-normal);
transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.expertise-card:hover {
@@ -1530,7 +1559,7 @@
display: flex;
flex-direction: column;
gap: 16px;
transition: all var(--transition-normal);
transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
text-decoration: none;
color: inherit;
}
@@ -1538,7 +1567,6 @@
.project-card:hover {
border-color: var(--accent);
box-shadow: 0 4px 12px var(--shadow);
transform: translateY(-2px);
color: inherit;
}
@@ -1602,7 +1630,7 @@
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 24px;
transition: all var(--transition-normal);
transition: border-color var(--transition-normal);
}
.philosophy-card:hover {
@@ -1666,13 +1694,12 @@
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
transition: all var(--transition-fast);
transition: border-color var(--transition-fast), color var(--transition-fast);
}
.contact-link:hover {
border-color: var(--accent);
color: var(--accent);
transform: translateY(-2px);
}
.contact-link svg {
@@ -1900,16 +1927,10 @@
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transform: translateY(10px);
transition: all var(--transition-normal);
transition: background var(--transition-fast);
z-index: 100;
}
.back-to-top.visible {
opacity: 1;
transform: translateY(0);
}
.back-to-top:hover {
background: var(--accent-hover);
+25 -5
View File
@@ -1,4 +1,5 @@
import { SectionHeading } from '@/components/ui/SectionHeading'
import { motion } from 'motion/react'
import { InView } from '@/components/ui/InView'
import { Tag } from '@/components/ui/Tag'
import { profile } from '@/data/profile'
@@ -9,7 +10,17 @@ export function About() {
const { lang } = useLanguage()
return (
<InView>
<section className="section container-wide" aria-labelledby="about-heading">
<motion.section
className="section container-wide"
aria-labelledby="about-heading"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.5 } },
}}
>
<SectionHeading title={strings.about.heading[lang]} tag={strings.about.heading[lang]} />
<p className="prose-lede lede-wide">
{useField(profile.bio, profile.bioEn)}
@@ -19,8 +30,17 @@ export function About() {
{strings.about.engineeringTitle[lang]}
</h3>
<div className="philosophy-grid">
{profile.philosophy.map((point) => (
<div key={point.title} className="philosophy-card">
{profile.philosophy.map((point, i) => (
<motion.div
key={point.title}
className="philosophy-card"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<h3>{point.title}</h3>
<p>{point.description}</p>
<div className="philosophy-keywords">
@@ -28,7 +48,7 @@ export function About() {
<Tag key={kw}>{kw}</Tag>
))}
</div>
</div>
</motion.div>
))}
</div>
@@ -42,7 +62,7 @@ export function About() {
</Tag>
))}
</div>
</section>
</motion.section>
</InView>
)
}
+18 -6
View File
@@ -27,8 +27,12 @@ export function Contact() {
<motion.a
href={`mailto:${profile.email}`}
className="contact-link"
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: 0 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<svg
viewBox="0 0 24 24"
@@ -55,8 +59,12 @@ export function Contact() {
target="_blank"
rel="noopener noreferrer"
className="contact-link"
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<svg
viewBox="0 0 24 24"
@@ -80,8 +88,12 @@ export function Contact() {
target="_blank"
rel="noopener noreferrer"
className="contact-link"
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: 0.16 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<svg
viewBox="0 0 24 24"
+6 -13
View File
@@ -18,10 +18,7 @@ export function Expertise() {
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: { staggerChildren: 0.1 },
},
visible: { opacity: 1, transition: { duration: 0.5 } },
}}
>
<SectionHeading title={strings.expertise.heading[lang]} tag={strings.expertise.heading[lang]} />
@@ -30,15 +27,11 @@ export function Expertise() {
<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 }}
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<h3>{useField(group.title, group.titleEn)}</h3>
+38 -30
View File
@@ -37,23 +37,26 @@ export function Hero() {
<InView>
<motion.section
className="hero container-wide"
initial={{opacity: 0}}
animate={{opacity: 1}}
transition={{duration: 0.3}}
initial="hidden"
whileInView="visible"
viewport={{once: true, amount: 0.1}}
variants={{
hidden: {opacity: 0},
visible: {opacity: 1, transition: {duration: 0.5}},
}}
aria-labelledby="hero-heading"
>
<div className="hero-bg-grid"/>
<HeroParticles/>
{/* Entrance belongs to the items (whileInView + delay 0, 0.08, 0.16, 0.24,
0.32, 0.4 = i * 0.08), exactly like the timeline entries; the wrapper no
longer slides in on its own, so there is one fade, not three. */}
<div className="hero-content">
<motion.div
className="hero-content"
initial={{opacity: 0, x: -30}}
animate={{opacity: 1, x: 0}}
transition={{duration: 0.6, delay: 0.2}}
>
<motion.div
initial={{opacity: 0, y: 10}}
animate={{opacity: 1, y: 0}}
transition={{duration: 0.4, delay: 0.15}}
initial={{opacity: 0, y: 24}}
whileInView={{opacity: 1, y: 0}}
viewport={{once: true, amount: 0.2}}
transition={{duration: 0.45, ease: "easeOut", delay: 0}}
>
<span className="hero-greeting">
<span className="greeting-dot"/>
@@ -63,32 +66,36 @@ export function Hero() {
<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}}
initial={{opacity: 0, y: 24}}
whileInView={{opacity: 1, y: 0}}
viewport={{once: true, amount: 0.2}}
transition={{duration: 0.45, ease: "easeOut", delay: 0.08}}
>
<span className="name-highlight">{useField(profile.name, profile.nameEn)}</span>
</motion.h1>
<motion.p
className="hero-title"
initial={{opacity: 0, y: 20}}
animate={{opacity: 1, y: 0}}
transition={{duration: 0.5, delay: 0.4}}
initial={{opacity: 0, y: 24}}
whileInView={{opacity: 1, y: 0}}
viewport={{once: true, amount: 0.2}}
transition={{duration: 0.45, ease: "easeOut", delay: 0.16}}
>
<Typewriter texts={profile.roles}/>
</motion.p>
<motion.p
className="hero-tagline"
initial={{opacity: 0, y: 20}}
animate={{opacity: 1, y: 0}}
transition={{duration: 0.5, delay: 0.5}}
initial={{opacity: 0, y: 24}}
whileInView={{opacity: 1, y: 0}}
viewport={{once: true, amount: 0.2}}
transition={{duration: 0.45, ease: "easeOut", delay: 0.24}}
dangerouslySetInnerHTML={{__html: useField(profile.tagline, profile.taglineEn)}}
/>
<motion.div
className="hero-cta"
initial={{opacity: 0, y: 20}}
animate={{opacity: 1, y: 0}}
transition={{duration: 0.5, delay: 0.6}}
initial={{opacity: 0, y: 24}}
whileInView={{opacity: 1, y: 0}}
viewport={{once: true, amount: 0.2}}
transition={{duration: 0.45, ease: "easeOut", delay: 0.32}}
>
<Button href="/projects" variant="primary">
{strings.hero.ctaProjects[lang]}
@@ -112,7 +119,7 @@ export function Hero() {
<SocialLinks />
</motion.div>
</motion.div>
</div>
<div className="scroll-indicator" aria-hidden="true">
<div className="scroll-mouse">
<div className="scroll-wheel"/>
@@ -121,15 +128,16 @@ export function Hero() {
</div>
<motion.div
className="hero-visual"
style={{y}}
initial={{opacity: 0, x: 30}}
animate={{opacity: 1, x: 0}}
transition={{duration: 0.6, delay: 0.4}}
initial={{opacity: 0, y: 24}}
whileInView={{opacity: 1, y: 0}}
viewport={{once: true, amount: 0.2}}
transition={{duration: 0.45, ease: "easeOut", delay: 0.4}}
>
<img
<motion.img
src="/profile-photo.webp"
alt="Profile photo"
className="hero-photo"
style={{y}}
/>
</motion.div>
</motion.section>
+134 -22
View File
@@ -1,33 +1,145 @@
import { useMemo } from "react"
import { useMemo, type CSSProperties } from "react"
import { motion, useScroll, useTransform, type MotionValue } from "motion/react"
/**
* The dots read as depth because each tier travels through a perspective-projected
* z range instead of being scaled by hand: a particle at z = -500px is projected at
* 700 / 1200 = 0.58x, one at z = +120px at 700 / 580 = 1.21x — so the near tier grows *and*
* fans out away from the vanishing point, which scale() alone cannot fake.
*
* `from` / `to` are raw translateY offsets from the top of the layer, tuned per tier
* so that after projection every tier crosses the whole hero box (derivation in
* App.css). Same projected distance + longer duration = slower on screen = further away.
*/
interface DepthTier {
id: "far" | "mid" | "near"
/** translateZ at 0% (deep) and 100% (towards the viewer) of one cycle, in px */
z: [number, number]
/** raw translateY at 0% and 100%, in vh from the top of the layer */
from: number
to: number
size: [number, number]
opacity: number
duration: [number, number]
/** ± lateral sweep in px; projection amplifies it, so the near tier sweeps widest */
drift: number
counts: { desktop: number; mobile: number }
/** px of scroll parallax across SCROLL_RANGE; the near tier moves fastest */
scrollShift: number
}
const FAR: DepthTier = {
id: "far",
z: [-500, -180],
from: 121,
to: -29,
size: [6, 9],
opacity: 0.22,
duration: [16, 24],
drift: 14,
counts: { desktop: 12, mobile: 6 },
scrollShift: -30,
}
const MID: DepthTier = {
id: "mid",
z: [-300, -60],
from: 114,
to: -14,
size: [7, 11],
opacity: 0.45,
duration: [11, 17],
drift: 26,
counts: { desktop: 12, mobile: 6 },
scrollShift: -60,
}
const NEAR: DepthTier = {
id: "near",
z: [-120, 120],
from: 103,
to: 17,
size: [7, 12],
opacity: 0.8,
duration: [7, 11],
drift: 40,
counts: { desktop: 6, mobile: 3 },
scrollShift: -100,
}
const depthTiers: DepthTier[] = [FAR, MID, NEAR]
const SCROLL_RANGE: [number, number] = [0, 500]
interface Particle {
id: number
left: number
size: number
duration: number
delay: number
drift: number
opacity: number
}
function createParticles(tier: DepthTier, count: number): Particle[] {
return Array.from({ length: count }, (_, id) => ({
id,
left: Math.random() * 100,
size: tier.size[0] + Math.random() * (tier.size[1] - tier.size[0]),
duration: tier.duration[0] + Math.random() * (tier.duration[1] - tier.duration[0]),
// Applied as a negative animation-delay: every cycle is already in progress at
// mount, so the hero is populated immediately instead of filling in over 10s.
delay: Math.random() * tier.duration[1],
drift: (Math.random() * 2 - 1) * tier.drift,
opacity: tier.opacity * (0.75 + Math.random() * 0.35),
}))
}
function particleStyle(particle: Particle, tier: DepthTier): CSSProperties {
return {
left: `${particle.left}%`,
width: `${particle.size}px`,
height: `${particle.size}px`,
animationDuration: `${particle.duration}s`,
animationDelay: `-${particle.delay}s`,
"--p-from": `${tier.from}vh`,
"--p-to": `${tier.to}vh`,
"--p-z0": `${tier.z[0]}px`,
"--p-z1": `${tier.z[1]}px`,
"--p-drift": `${particle.drift}px`,
"--p-op": particle.opacity,
} as CSSProperties
}
export function HeroParticles() {
const count = typeof window !== "undefined" && window.innerWidth < 768 ? 15 : 30
const particles = useMemo(
const isMobile = typeof window !== "undefined" && window.innerWidth < 768
const { scrollY } = useScroll()
const layerY: Record<DepthTier["id"], MotionValue<number>> = {
far: useTransform(scrollY, SCROLL_RANGE, [0, FAR.scrollShift]),
mid: useTransform(scrollY, SCROLL_RANGE, [0, MID.scrollShift]),
near: useTransform(scrollY, SCROLL_RANGE, [0, NEAR.scrollShift]),
}
const layers = useMemo(
() =>
Array.from({ length: count }, (_, i) => ({
id: i,
left: `${Math.random() * 100}%`,
duration: `${Math.random() * 10 + 6}s`,
delay: `${Math.random() * 10}s`,
size: `${Math.random() * 10 + 6}px`,
depthTiers.map((tier) => ({
tier,
particles: createParticles(tier, isMobile ? tier.counts.mobile : tier.counts.desktop),
})),
[count],
[isMobile],
)
return (
<div className="hero-particles" aria-hidden="true">
{particles.map((p) => (
<div
key={p.id}
className="hero-particle"
style={{
left: p.left,
width: p.size,
height: p.size,
animationDuration: p.duration,
animationDelay: p.delay,
}}
/>
{layers.map(({ tier, particles }) => (
<motion.div
key={tier.id}
className={`hero-particle-layer hero-particle-layer--${tier.id}`}
style={{ y: layerY[tier.id] }}
>
{particles.map((particle) => (
<div key={particle.id} className="hero-particle" style={particleStyle(particle, tier)} />
))}
</motion.div>
))}
</div>
)
+5 -12
View File
@@ -24,10 +24,7 @@ export function Projects() {
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: { staggerChildren: 0.1 },
},
visible: { opacity: 1, transition: { duration: 0.5 } },
}}
>
<SectionHeading title={strings.projects.featured[lang]} tag={strings.projects.featured[lang]} />
@@ -43,14 +40,10 @@ export function Projects() {
key={project.id}
to={`/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 },
},
}}
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
-37
View File
@@ -1,37 +0,0 @@
import { motion } from "motion/react"
import { InView } from "@/components/ui/InView"
import type { ReactNode } from "react"
interface AnimatedSectionProps {
direction?: "up" | "right" | "left"
delay?: number
children: ReactNode
}
function getDirection(direction: 'up' | 'right' | 'left') {
switch (direction) {
case 'up': return { y: [40, 0], opacity: [0, 1] }
case 'right': return { x: [-40, 0], opacity: [0, 1] }
case 'left': return { x: [40, 0], opacity: [0, 1] }
}
}
export function AnimatedSection({
direction = "up",
delay = 0,
children,
}: AnimatedSectionProps) {
const { y, opacity } = getDirection(direction)
return (
<InView>
<motion.div
initial={{ y, opacity }}
whileInView={{ y: 0, opacity: 1 }}
viewport={{ once: true, margin: "0px 0px -50px 0px" }}
transition={{ duration: 0.6, delay, ease: [0.25, 0.1, 0.25, 1] }}
>
{children}
</motion.div>
</InView>
)
}
+3
View File
@@ -59,6 +59,7 @@ export const Button = forwardRef<
to={href}
className={classes}
ref={ref as React.Ref<HTMLAnchorElement>}
whileHover={{ y: -2 }}
whileTap={{ scale: 0.95 }}
{...(safeProps as Omit<
React.AnchorHTMLAttributes<HTMLAnchorElement>,
@@ -78,6 +79,7 @@ export const Button = forwardRef<
href={href}
className={classes}
ref={ref as React.Ref<HTMLAnchorElement>}
whileHover={{ y: -2 }}
whileTap={{ scale: 0.95 }}
{...(props as Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof ButtonProps>)}
>
@@ -93,6 +95,7 @@ export const Button = forwardRef<
<motion.button
className={classes}
ref={ref as React.Ref<HTMLButtonElement>}
whileHover={{ y: -2 }}
whileTap={{ scale: 0.95 }}
{...(props as Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonProps>)}
>
+54 -15
View File
@@ -1,6 +1,7 @@
import { AnimatedSection } from '@/components/ui/AnimatedSection'
import { motion } from 'motion/react'
import { SectionHeading } from '@/components/ui/SectionHeading'
import { Tag } from '@/components/ui/Tag'
import { InView } from '@/components/ui/InView'
import { profile } from '@/data/profile'
import { skillGroups } from '@/data/skills'
import { useLanguage } from '@/hooks/useLanguage'
@@ -11,8 +12,18 @@ export function AboutPage() {
const { lang } = useLanguage()
return (
<>
<AnimatedSection>
<section className="section container-wide" aria-labelledby="about-heading">
<InView>
<motion.section
className="section container-wide"
aria-labelledby="about-heading"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.5 } },
}}
>
<SectionHeading
title={strings.about.heading[lang]}
subtitle={strings.about.subtitle[lang]}
@@ -26,8 +37,17 @@ export function AboutPage() {
{strings.about.engineeringTitle[lang]}
</h3>
<div className="philosophy-grid">
{profile.philosophy.map((point) => (
<div key={point.title} className="philosophy-card">
{profile.philosophy.map((point, i) => (
<motion.div
key={point.title}
className="philosophy-card"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<h3>{point.title}</h3>
<p>{point.description}</p>
<div className="philosophy-keywords">
@@ -35,7 +55,7 @@ export function AboutPage() {
<Tag key={kw}>{kw}</Tag>
))}
</div>
</div>
</motion.div>
))}
</div>
@@ -49,14 +69,33 @@ export function AboutPage() {
</Tag>
))}
</div>
</section>
</AnimatedSection>
<AnimatedSection>
<section className="section container-wide" aria-labelledby="expertise-heading">
</motion.section>
</InView>
<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: { duration: 0.5 } },
}}
>
<SectionHeading title={strings.about.expertise[lang]} />
<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"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<h3>{useField(group.title, group.titleEn)}</h3>
<ul className="expertise-skills">
{group.skills.map((skill: string) => (
@@ -65,11 +104,11 @@ export function AboutPage() {
</li>
))}
</ul>
</div>
</motion.div>
))}
</div>
</section>
</AnimatedSection>
</motion.section>
</InView>
</>
)
}
+53 -8
View File
@@ -1,15 +1,37 @@
import { SectionHeading } from '@/components/ui/SectionHeading'
import { DownloadResume } from '@/components/sections/DownloadResume'
import { motion } from 'motion/react'
import { InView } from '@/components/ui/InView'
import { profile } from '@/data/profile'
import { useLanguage } from '@/hooks/useLanguage'
import { strings } from '@/i18n/strings'
export function ContactPage() {
const { lang } = useLanguage()
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={strings.contact.heading[lang]} tag={strings.common.contactTag[lang]} />
<div className="contact-links">
<a href={`mailto:${profile.email}`} className="contact-link">
<motion.a
href={`mailto:${profile.email}`}
className="contact-link"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: 0 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<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" />
@@ -18,8 +40,19 @@ export function ContactPage() {
<div className="link-label">{strings.contact.email[lang]}</div>
<div className="contact-link-sub">{profile.email}</div>
</div>
</a>
<a href={profile.githubUrl} target="_blank" rel="noopener noreferrer" className="contact-link">
</motion.a>
<motion.a
href={profile.githubUrl}
target="_blank"
rel="noopener noreferrer"
className="contact-link"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<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>
@@ -27,8 +60,19 @@ export function ContactPage() {
<div className="link-label">{strings.contact.github[lang]}</div>
<div className="contact-link-sub">@dong-nz</div>
</div>
</a>
<a href={profile.linkedinUrl} target="_blank" rel="noopener noreferrer" className="contact-link">
</motion.a>
<motion.a
href={profile.linkedinUrl}
target="_blank"
rel="noopener noreferrer"
className="contact-link"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: 0.16 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<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>
@@ -36,9 +80,10 @@ export function ContactPage() {
<div className="link-label">{strings.contact.linkedin[lang]}</div>
<div className="contact-link-sub">@dong-nz</div>
</div>
</a>
</motion.a>
</div>
<DownloadResume />
</section>
</motion.section>
</InView>
)
}
+15 -2
View File
@@ -1,5 +1,6 @@
import { motion } from 'motion/react'
import { SectionHeading } from '@/components/ui/SectionHeading'
import { InView } from '@/components/ui/InView'
import { experiences } from '@/data/experience'
import { useLanguage } from '@/hooks/useLanguage'
import { strings } from '@/i18n/strings'
@@ -8,7 +9,18 @@ import { useField, useFieldArray } from '@/i18n/useField'
export function ExperiencePage() {
const { lang } = useLanguage()
return (
<section className="section container-content" aria-labelledby="experience-heading">
<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: { duration: 0.5 } },
}}
>
<SectionHeading title={strings.experience.heading[lang]} tag={strings.common.experienceTag[lang]} />
<div className="timeline">
{experiences.map((exp, i) => (
@@ -42,6 +54,7 @@ export function ExperiencePage() {
<p className="timeline-tldr-text">{strings.experience.tldrText[lang]}</p>
</div>
</div>
</section>
</motion.section>
</InView>
)
}
+26 -5
View File
@@ -1,4 +1,6 @@
import {SectionHeading} from '@/components/ui/SectionHeading'
import {motion} from 'motion/react'
import {InView} from '@/components/ui/InView'
import {useLanguage} from '@/hooks/useLanguage'
import {strings} from '@/i18n/strings'
@@ -6,18 +8,37 @@ import {strings} from '@/i18n/strings'
export function PhilosophyPage() {
const {lang} = useLanguage()
return (
<section className="section container-content" aria-labelledby="philosophy-heading">
<InView>
<motion.section
className="section container-content"
aria-labelledby="philosophy-heading"
initial="hidden"
whileInView="visible"
viewport={{once: true, amount: 0.1}}
variants={{
hidden: {opacity: 0},
visible: {opacity: 1, transition: {duration: 0.5}},
}}
>
<SectionHeading id="philosophy-heading" title={strings.philosophy.heading[lang]} tag={strings.philosophy.heading[lang]}/>
<div className="prose prose-wide">
{strings.philosophy.quotes.map((quote) => (
<div key={quote.title[lang]} className="philosophy-quote">
{strings.philosophy.quotes.map((quote, i) => (
<motion.div
key={quote.title[lang]}
className="philosophy-quote"
initial={{opacity: 0, y: 24}}
whileInView={{opacity: 1, y: 0}}
viewport={{once: true, amount: 0.2}}
transition={{duration: 0.45, ease: 'easeOut', delay: i * 0.08}}
>
<h3>
{quote.title[lang]}
</h3>
<div dangerouslySetInnerHTML={{__html: quote.details[lang]}}/>
</div>
</motion.div>
))}
</div>
</section>
</motion.section>
</InView>
)
}
+87 -17
View File
@@ -1,11 +1,23 @@
import { useParams, Link } from 'react-router'
import { motion, type Transition } from 'motion/react'
import { Badge } from '@/components/ui/Badge'
import { Tag } from '@/components/ui/Tag'
import { InView } from '@/components/ui/InView'
import { projects } from '@/data/projects'
import { useLanguage } from '@/hooks/useLanguage'
import { strings } from '@/i18n/strings'
import { useField } from '@/i18n/useField'
const sectionVariants = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.5 } },
}
const itemTransition = (delay: number): Transition => ({
duration: 0.45,
ease: 'easeOut',
delay,
})
export function ProjectDetailPage() {
const { id } = useParams<{ id: string }>()
@@ -14,33 +26,66 @@ export function ProjectDetailPage() {
if (!project) {
return (
<section className="section container-content">
<InView>
<motion.section
className="section container-content"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={sectionVariants}
>
<h2>{strings.projectDetail.notFound[lang]}</h2>
<p>
<Link to="/projects">{strings.projectDetail.backToProjects[lang]} ←</Link>
</p>
</section>
</motion.section>
</InView>
)
}
return (
<section className="section container-content" aria-labelledby="project-title">
<InView>
<motion.section
className="section container-content"
aria-labelledby="project-title"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={sectionVariants}
>
<Link to="/projects" className="back-link">
{strings.projectDetail.backToProjects[lang]} ←
</Link>
<div style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '16px' }}>
<motion.div
style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '16px' }}
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={itemTransition(0)}
>
<h1 id="project-title" style={{ flex: 1 }}>{project.title}</h1>
<Badge variant="outline">{strings.projects.categories[project.category][lang]}</Badge>
</div>
</motion.div>
<p className="prose-lede">
<motion.p
className="prose-lede"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={itemTransition(0.08)}
>
{useField(project.summary, project.summaryEn)}
</p>
</motion.p>
<div className="prose">
{project.metrics && project.metrics.length > 0 && (
<div>
<motion.div
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={itemTransition(0.16)}
>
<h3>{strings.projectDetail.impact[lang]}</h3>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap' }}>
{project.metrics.map((m) => (
@@ -49,36 +94,61 @@ export function ProjectDetailPage() {
</span>
))}
</div>
</div>
</motion.div>
)}
<div>
<motion.div
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={itemTransition(0.24)}
>
<h3>{strings.projectDetail.role[lang]}</h3>
<p>{project.role}</p>
</div>
</motion.div>
<div>
<motion.div
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={itemTransition(0.32)}
>
<h3>{strings.projectDetail.technologies[lang]}</h3>
<div className="philosophy-keywords">
{project.technologies.map((tech) => (
<Tag key={tech}>{tech}</Tag>
))}
</div>
</div>
</motion.div>
{project.sections && project.sections.length > 0 && (
<div>
<h3>{strings.projectDetail.experiments[lang]}</h3>
<motion.h3
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={itemTransition(0.4)}
>
{strings.projectDetail.experiments[lang]}
</motion.h3>
{project.sections.map((section, idx) => (
<div key={idx} className="project-section">
<motion.div
key={idx}
className="project-section"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={itemTransition(0.48 + idx * 0.08)}
>
<h4>{useField(section.title, section.titleEn)}</h4>
<p>{useField(section.content, section.contentEn)}</p>
<Tag accent>{section.type}</Tag>
</div>
</motion.div>
))}
</div>
)}
</div>
</section>
</motion.section>
</InView>
)
}
+27 -5
View File
@@ -1,5 +1,7 @@
import { SectionHeading } from '@/components/ui/SectionHeading'
import { Badge } from '@/components/ui/Badge'
import { motion } from 'motion/react'
import { InView } from '@/components/ui/InView'
import { projects } from '@/data/projects'
import { useLanguage } from '@/hooks/useLanguage'
import { strings } from '@/i18n/strings'
@@ -7,17 +9,36 @@ import { useField } from '@/i18n/useField'
import { Link } from 'react-router'
const MotionLink = motion.create(Link)
export function ProjectsListPage() {
const { lang } = useLanguage()
return (
<section className="section container-wide" aria-labelledby="projects-heading">
<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: { duration: 0.5 } },
}}
>
<SectionHeading title={strings.projects.all[lang]} tag={strings.projects.all[lang]} />
<div className="projects-grid">
{projects.map((project) => (
<Link
{projects.map((project, i) => (
<MotionLink
key={project.id}
to={`/projects/${project.id}`}
className="project-card"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<div className="project-card-header">
<h3>{project.title}</h3>
@@ -34,9 +55,10 @@ export function ProjectsListPage() {
))}
</div>
<span className="project-card-cta">{strings.projects.viewDetails[lang]} →</span>
</Link>
</MotionLink>
))}
</div>
</section>
</motion.section>
</InView>
)
}