feat: hero photo background, Open to Work badge, contact section, resume download

This commit is contained in:
dong.nguyen committed 2026-10-06 15:49:10 +07:00
1 parent d827bf9b23
commit 531c70e13a
10 files changed
+304 -96

No files matched your search

+2 -1
View File
@@ -22,13 +22,14 @@ v2 bao gồm 6 tính năng, mỗi tính năng có spec riêng trong `specs/`:
| File | Feature | Priority | Est. | Status |
|------|---------|----------|------|--------|
| `specs/v2/spec-v2-resume.md` | Resume download | P1 | ~15 min | ✅ Done |
| `specs/v2/spec-v2-hero-carousel.md` | Hero visual carousel | P1 | ~1 hour | |
| `specs/v2/spec-v2-seo.md` | SEO (metadata, OG, sitemap) | P1 | ~1 hour | |
| `specs/v2/spec-v2-blog.md` | Blog (MDX, articles, syntax highlight) | P1 | ~4 hours | |
| `specs/v2/spec-v2-analytics.md` | Analytics (Plausible) | P2 | ~30 min | |
| `specs/v2/spec-v2-testing.md` | Testing (Vitest + E2E) | P5 | ~3 hours | |
| `specs/v2/spec-v2-cicd.md` | CI/CD (GitHub Actions) | P5 | ~1 hour | |
**Implementation order:** ~~Resume~~ → SEO → Blog → Analytics → Testing → CI/CD
**Implementation order:** ~~Resume~~ → Hero Carousel → SEO → Blog → Analytics → Testing → CI/CD
---
+130
View File
@@ -0,0 +1,130 @@
# UI Spec - Hero Photo Background + Open to Work Badge
## Overview
Thay thế hero-visual (SVG diagram) bằng profile photo background, fill toàn bộ vùng bên phải hero section. Badge "Open to Work" overlay ở góc dưới ảnh.
---
## Structure
```
Hero (section)
├── hero-photo-bg (div, ảnh nền)
│ └── profile-photo.webp (img, object-fit: cover)
├── hero-content (div, text bên trái)
│ ├── hero-name (h1)
│ ├── hero-title (p)
│ ├── hero-tagline (p)
│ ├── hero-cta (div, buttons)
│ └── SocialLinks
└── OpenToWorkBadge (component, góc dưới-right)
├── icon (checkmark)
├── "Open to Work" (text chính)
└── "Software Engineer" (subtitle)
```
---
## Hero Photo Background
### Desktop
- Position: absolute, fill `hero-visual` area
- `object-fit: cover` — fill hết khung, cắt phần thừa
- `object-position: center top` — giữ khuôn mặt ở trên
- Border-radius: 0 (khung vuông/tròn?)
- Z-index: 0 (nằm dưới text)
### Mobile
- Position: absolute, fill TOÀN BỘ hero section
- `object-fit: cover`
- Overlay gradient để text readable
---
## Text Overlay
### Desktop
- Text nằm bên trái, không đè lên ảnh
- Giữ layout 2 cột hiện tại
- Không cần overlay
### Mobile
- Overlay gradient từ trái qua (transparent → dark)
- Hoặc overlay bán trong suốt toàn bộ hero
- Đảm bảo text contrast ratio ≥ 4.5:1
---
## Open to Work Badge
### Design
- Shape: bo góc 12px
- Background: accent color (hoặc gradient accent)
- Size: 200x200 (max-width: 200px)
- Padding: 20px
- Shadow: subtle drop shadow
### Content
```
┌──────────────────┐
│ ✓ Open to Work │
│ Software │
│ Engineer │
└──────────────────┘
```
- Icon: checkmark (SVG inline)
- Title: "Open to Work" — bold, 18px
- Subtitle: "Software Engineer" — regular, 14px, muted
- Icon + Title: cùng dòng
- Subtitle: dòng dưới
### Position
- Desktop: góc dưới-right của `hero-visual`
- Mobile: góc dưới-right của hero section
- Margin: 20px từ cạnh
---
## Responsive
### Desktop (>768px)
```
┌──────────────────────────────────────┐
│ Text Content │ Photo BG │
│ (left 50%) │ (right 50%) │
│ │ │
│ │ [OTW] │
└──────────────────────────────────────┘
```
### Mobile (≤768px)
```
┌──────────────────────────────┐
│ Photo BG (full) │
│ ┌────────────────────────┐ │
│ │ Text Content + Overlay │ │
│ └────────────────────────┘ │
│ [OTW] │
└──────────────────────────────┘
```
---
## Constraints
- Không hard-code nội dung trong JSX — data-driven từ `profile.ts`
- Ảnh fallback: placeholder gray nếu thiếu asset
- Giảm motion: không animation khi scroll
- Accessibility: alt text cho ảnh, aria-label cho badge
- Không thay đổi layout text content bên trái
+57 -40
View File
@@ -1,7 +1,7 @@
# Specification — v2 Resume Download
> **Document:** `spec-v2-resume.md`
> **Version:** 0.3.0
> **Version:** 0.4.0
> **Parent:** `spec-v2.md`
> **Priority:** P1
> **Estimate:** ~15 minutes
@@ -12,7 +12,7 @@
- Nút **"Download Resume"** hiển thị ở **2 vị trí**:
1. **Hero section** — CTA row (bên cạnh "View Projects" / "Contact Me")
2. **Contact section** — trong `contact-links` grid
2. **Contact section / Contact page** — riêng biệt, sau `contact-links` grid
- Link trực tiếp đến file PDF (`/resume.pdf`) với attribute `download`
- Khi chưa có PDF → ẩn hoàn toàn ở cả 2 vị trí
- PDF upload vào `public/resume.pdf`
@@ -22,60 +22,77 @@
## Implementation
### DownloadResume Component
```tsx
// src/components/sections/DownloadResume.tsx
import { resumeAvailable } from '@/data/resume'
export function DownloadResume() {
if (!resumeAvailable) return null
return (
<div style={{ marginTop: '32px' }}>
<a href="/resume.pdf" download className="contact-link" style={...}>
<svg>...</svg>
<div>Download Resume</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>PDF</div>
</a>
</div>
)
}
```
### Hero Section (primary CTA)
```tsx
// Hero.tsx
import { Button } from '@/components/ui/Button'
import { resumeAvailable } from '@/data/resume'
export function Hero() {
return (
<section className="hero container-wide" aria-labelledby="hero-heading">
<div className="hero-content">
{/* ... heading, title, tagline ... */}
<div className="hero-cta">
<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>
</div>
<SocialLinks links={socialLinks} />
<div className="hero-cta">
<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>
</div>
)
}
```
### Contact Section (home page)
```tsx
// Contact.tsx
import { DownloadResume } from '@/components/sections/DownloadResume'
export function Contact() {
return (
<section>
<SectionHeading title="Contact" />
<div className="contact-links">
{/* Email, GitHub, LinkedIn */}
</div>
{/* ... hero-visual ... */}
<DownloadResume />
</section>
)
}
```
### Contact Section (secondary)
### ContactPage (standalone page)
```tsx
// Contact.tsx
import { resumeAvailable } from '@/data/resume'
// ContactPage.tsx
import { DownloadResume } from '@/components/sections/DownloadResume'
export function Contact() {
export function ContactPage() {
return (
<section className="section container-content" aria-labelledby="contact-heading">
<SectionHeading title="Contact" />
<div className="contact-links">
{/* ... existing links (Email, GitHub, LinkedIn) ... */}
{resumeAvailable && (
<a href="/resume.pdf" download className="contact-link btn-primary">
<svg>...</svg>
<div>
<div>Download Resume</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>PDF</div>
</div>
</a>
)}
</div>
<section>
<h2>Contact</h2>
<div className="contact-links">...</div>
<DownloadResume />
</section>
)
}
@@ -95,10 +112,10 @@ Nút Resume trong nav chỉ hiện khi có `/resume` route (HTML resume page).
---
## Acceptance
- [x] Nút "Download Resume" hiển thị trong Hero CTA row
- [x] Nút "Download Resume" hiển thị trong Contact section
- [x] DownloadResume component riêng, dùng lại trong Contact section và ContactPage
- [x] Click → download PDF từ `/resume.pdf`
- [x] Khi chưa có PDF → ẩn hoàn toàn ở cả 2 vị trí
- [x] Responsive trên mobile
- [x] Nav không có nút Resume (Phase 2)
Binary file not shown.
+60 -10
View File
@@ -400,26 +400,60 @@
}
.hero-visual {
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.hero-graphic {
.hero-photo {
width: 100%;
max-width: 400px;
aspect-ratio: 1;
position: relative;
height: 100%;
object-fit: cover;
object-position: center top;
border-radius: 16px;
display: block;
}
.otw-badge {
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);
display: flex;
flex-direction: column;
gap: 6px;
max-width: 200px;
}
.otw-icon {
width: 16px;
height: 16px;
margin-bottom: 2px;
}
.otw-title {
font-size: 18px;
font-weight: 700;
line-height: 1.2;
}
.otw-subtitle {
font-size: 14px;
opacity: 0.9;
line-height: 1.3;
}
@media (max-width: 768px) {
.hero {
grid-template-columns: 1fr;
gap: 32px;
min-height: auto;
padding: 48px 0;
position: relative;
min-height: 500px;
overflow: hidden;
}
.hero-cta {
flex-direction: column;
}
@@ -429,7 +463,23 @@
}
.hero-visual {
display: none;
position: absolute;
inset: 0;
z-index: 0;
}
.hero-content {
position: relative;
z-index: 1;
background: rgba(0, 0, 0, 0.55);
padding: 32px 24px;
border-radius: 16px;
backdrop-filter: blur(4px);
}
.otw-badge {
bottom: 16px;
right: 16px;
padding: 16px;
}
}
+2 -14
View File
@@ -1,4 +1,4 @@
import { resumeAvailable } from '@/data/resume'
import { DownloadResume } from '@/components/sections/DownloadResume'
import { SectionHeading } from '@/components/ui/SectionHeading'
import { profile } from '@/data/profile'
@@ -35,20 +35,8 @@ export function Contact() {
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>Your Name</div>
</div>
</a>
{resumeAvailable && (
<a href="/resume.pdf" download className="contact-link">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
<div>
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>Download Resume</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>PDF</div>
</div>
</a>
)}
</div>
<DownloadResume />
</section>
)
}
@@ -0,0 +1,21 @@
import { resumeAvailable } from '@/data/resume'
export function DownloadResume() {
if (!resumeAvailable) return null
return (
<div style={{ marginTop: '32px' }}>
<a href="/resume.pdf" download className="contact-link" style={{ display: 'flex', alignItems: 'center', gap: '12px', padding: '12px 20px', borderRadius: '8px', textDecoration: 'none', color: 'var(--text-primary)', border: '1px solid var(--border)' }}>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
<div>
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>Download Resume</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>PDF</div>
</div>
</a>
</div>
)
}
+7 -31
View File
@@ -1,3 +1,4 @@
import { OpenToWorkBadge } from '@/components/ui/OpenToWorkBadge'
import { resumeAvailable } from '@/data/resume'
import { Button } from '@/components/ui/Button'
import { SocialLinks } from '@/components/ui/SocialLinks'
@@ -62,37 +63,12 @@ export function Hero() {
<SocialLinks links={socialLinks} />
</div>
<div className="hero-visual">
<div className="hero-graphic">
<svg viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
{/* Abstract system diagram */}
<circle cx="200" cy="200" r="160" stroke="var(--border)" strokeWidth="1" />
<circle cx="200" cy="200" r="100" stroke="var(--border)" strokeWidth="1" />
<circle cx="200" cy="200" r="40" stroke="var(--accent)" strokeWidth="2" opacity="0.6" />
{/* Nodes */}
<circle cx="200" cy="80" r="8" fill="var(--accent)" opacity="0.8" />
<circle cx="320" cy="200" r="8" fill="var(--accent)" opacity="0.8" />
<circle cx="200" cy="320" r="8" fill="var(--accent)" opacity="0.8" />
<circle cx="80" cy="200" r="8" fill="var(--accent)" opacity="0.8" />
{/* Connections */}
<line x1="200" y1="88" x2="200" y2="160" stroke="var(--accent)" strokeWidth="1" opacity="0.4" />
<line x1="312" y1="200" x2="240" y2="200" stroke="var(--accent)" strokeWidth="1" opacity="0.4" />
<line x1="200" y1="312" x2="200" y2="240" stroke="var(--accent)" strokeWidth="1" opacity="0.4" />
<line x1="88" y1="200" x2="160" y2="200" stroke="var(--accent)" strokeWidth="1" opacity="0.4" />
{/* Diagonal connections */}
<line x1="206" y1="86" x2="314" y2="194" stroke="var(--accent)" strokeWidth="0.5" opacity="0.2" />
<line x1="314" y1="206" x2="206" y2="314" stroke="var(--accent)" strokeWidth="0.5" opacity="0.2" />
<line x1="194" y1="314" x2="86" y2="206" stroke="var(--accent)" strokeWidth="0.5" opacity="0.2" />
<line x1="86" y1="194" x2="194" y2="86" stroke="var(--accent)" strokeWidth="0.5" opacity="0.2" />
{/* Center label */}
<text x="200" y="205" textAnchor="middle" fill="var(--accent)" fontSize="14" fontFamily="monospace">
core
</text>
</svg>
</div>
<img
src="/profile-photo.webp"
alt="Profile photo"
className="hero-photo"
/>
<OpenToWorkBadge />
</div>
</section>
)
+23
View File
@@ -0,0 +1,23 @@
import { profile } from '@/data/profile'
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"
>
<polyline points="20 6 9 17 4 12" />
</svg>
<span className="otw-title">Open to Work</span>
<span className="otw-subtitle">{profile.title}</span>
</div>
)
}
+2
View File
@@ -1,3 +1,4 @@
import { DownloadResume } from '@/components/sections/DownloadResume'
import { profile } from '@/data/profile'
export function ContactPage() {
@@ -36,6 +37,7 @@ export function ContactPage() {
</div>
</a>
</div>
<DownloadResume />
</section>
)
}