mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
feat(resume): add dropdown for download on desktop, 2 buttons on mobile
- DownloadResume: single dropdown button on desktop (≥769px), 2 separate buttons on mobile (<769px) - Hero CTA: same pattern — dropdown on desktop, 2 buttons on mobile - Use native <details>/<summary> for dropdown — no React state needed - CSS: dropdown with chevron animation, hover states, breakpoint-based visibility toggle - Mobile: keep existing 2-button layout with language labels
This commit is contained in:
1 parent
1b5c55fbaf
commit
c8f86aea90
3 files changed
+201
-10
No files matched your search
+101
@@ -478,6 +478,107 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Download Resume Dropdown ===== */
|
||||||
|
.download-resume-dropdown {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-summary {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 12px 20px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
list-style: none;
|
||||||
|
color: var(--text-primary);
|
||||||
|
background: var(--surface);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
user-select: none;
|
||||||
|
transition: border-color 0.2s, color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-summary::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-summary:hover {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-summary .chevron {
|
||||||
|
margin-left: auto;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-dropdown[open] .download-resume-summary .chevron {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-options {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 4px);
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
z-index: 100;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-option {
|
||||||
|
display: block;
|
||||||
|
padding: 10px 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-size: 14px;
|
||||||
|
transition: background 0.15s, color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-option:hover {
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hero-specific overrides */
|
||||||
|
.hero-download-dropdown .download-resume-summary {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-download-option {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Desktop: show dropdown, hide mobile buttons */
|
||||||
|
.download-resume-desktop,
|
||||||
|
.hero-download-desktop {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-mobile,
|
||||||
|
.hero-download-mobile {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile: show 2 buttons, hide dropdown */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.download-resume-desktop,
|
||||||
|
.hero-download-desktop {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-resume-mobile,
|
||||||
|
.hero-download-mobile {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ===== Expertise Grid ===== */
|
/* ===== Expertise Grid ===== */
|
||||||
.expertise-grid {
|
.expertise-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function DownloadButton({ lang }: { lang: Language }) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
|
<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" />
|
<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" />
|
<polyline points="7 10 12 15 17 10" />
|
||||||
<line x1="12" y1="15" x2="12" y2="3" />
|
<line x1="12" y1="15" x2="12" y2="3" />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -36,15 +36,52 @@ function DownloadButton({ lang }: { lang: Language }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function DownloadDropdown() {
|
||||||
|
return (
|
||||||
|
<details className="download-resume-dropdown">
|
||||||
|
<summary className="download-resume-summary">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="20" height="20">
|
||||||
|
<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>
|
||||||
|
<span>Download Resume</span>
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="16" height="16" className="chevron">
|
||||||
|
<polyline points="6 9 12 15 18 9" />
|
||||||
|
</svg>
|
||||||
|
</summary>
|
||||||
|
<div className="download-resume-options">
|
||||||
|
{resumeLanguages.map(lang => (
|
||||||
|
<a
|
||||||
|
key={lang}
|
||||||
|
href={resumeUrlFor(lang)}
|
||||||
|
download
|
||||||
|
className="download-resume-option"
|
||||||
|
>
|
||||||
|
{langLabels[lang]}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export function DownloadResume() {
|
export function DownloadResume() {
|
||||||
if (!resumeAvailable) return null
|
if (!resumeAvailable) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ marginTop: '32px' }}>
|
<div style={{ marginTop: '32px' }}>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
{/* Desktop: dropdown */}
|
||||||
{resumeLanguages.map(lang => (
|
<div className="download-resume-desktop">
|
||||||
<DownloadButton key={lang} lang={lang} />
|
<DownloadDropdown />
|
||||||
))}
|
</div>
|
||||||
|
{/* Mobile: 2 buttons */}
|
||||||
|
<div className="download-resume-mobile">
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
||||||
|
{resumeLanguages.map(lang => (
|
||||||
|
<DownloadButton key={lang} lang={lang} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,56 @@
|
|||||||
import { motion, useScroll, useTransform } from "motion/react"
|
import { motion, useScroll, useTransform } from "motion/react"
|
||||||
import { InView } from "@/components/ui/InView"
|
import { InView } from "@/components/ui/InView"
|
||||||
import { resumeAvailable, resumeLanguages, resumeUrlFor } from "@/data/resume"
|
import { resumeAvailable, resumeLanguages, resumeUrlFor } from "@/data/resume"
|
||||||
|
import type { Language } from '@/types'
|
||||||
|
|
||||||
|
const langLabels: Record<Language, string> = {
|
||||||
|
en: 'EN',
|
||||||
|
vi: 'VI',
|
||||||
|
}
|
||||||
|
|
||||||
|
function HeroDownloadDropdown() {
|
||||||
|
return (
|
||||||
|
<details className="download-resume-dropdown hero-download-dropdown">
|
||||||
|
<summary className="download-resume-summary hero-download-summary">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="18" height="18">
|
||||||
|
<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>
|
||||||
|
<span>Download Resume</span>
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="14" height="14" className="chevron">
|
||||||
|
<polyline points="6 9 12 15 18 9" />
|
||||||
|
</svg>
|
||||||
|
</summary>
|
||||||
|
<div className="download-resume-options">
|
||||||
|
{resumeLanguages.map(lang => (
|
||||||
|
<a
|
||||||
|
key={lang}
|
||||||
|
href={resumeUrlFor(lang)}
|
||||||
|
download
|
||||||
|
target="_blank"
|
||||||
|
className="download-resume-option"
|
||||||
|
>
|
||||||
|
{langLabels[lang]}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function HeroDownloadButton({ lang }: { lang: Language }) {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={resumeUrlFor(lang)}
|
||||||
|
download
|
||||||
|
target="_blank"
|
||||||
|
className="btn btn-secondary hero-download-mobile-btn"
|
||||||
|
>
|
||||||
|
Download Resume ({langLabels[lang]})
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
import { Button } from "@/components/ui/Button"
|
import { Button } from "@/components/ui/Button"
|
||||||
import { SocialLinks } from "@/components/ui/SocialLinks"
|
import { SocialLinks } from "@/components/ui/SocialLinks"
|
||||||
import { profile } from "@/data/profile"
|
import { profile } from "@/data/profile"
|
||||||
@@ -95,11 +145,14 @@ export function Hero() {
|
|||||||
</Button>
|
</Button>
|
||||||
{resumeAvailable && (
|
{resumeAvailable && (
|
||||||
<>
|
<>
|
||||||
{resumeLanguages.map(lang => (
|
<div className="hero-download-desktop">
|
||||||
<Button key={lang} href={resumeUrlFor(lang)} variant="secondary" target="_blank">
|
<HeroDownloadDropdown />
|
||||||
Download Resume ({lang === 'en' ? 'EN' : 'VI'})
|
</div>
|
||||||
</Button>
|
<div className="hero-download-mobile">
|
||||||
))}
|
{resumeLanguages.map(lang => (
|
||||||
|
<HeroDownloadButton key={lang} lang={lang} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Button href="/contact" variant="secondary">
|
<Button href="/contact" variant="secondary">
|
||||||
|
|||||||
Reference in new issue
Block a user