feat: add lazer border effect to download resume buttons

- Add rotating conic gradient border animation using pure CSS
- Apply to both Hero section dropdown and Contact section dropdown
- Shared wrapper for proper positioning context
- Flex layout for correct height calculation
- Respects prefers-reduced-motion
This commit is contained in:
dong.nguyen committed 2026-10-13 13:10:56 +07:00
1 parent f1d249061e
commit 21311d311d
3 files changed
+139 -57

No files matched your search

+70 -4
View File
@@ -691,7 +691,7 @@
/* ===== Download Resume Dropdown ===== */ /* ===== Download Resume Dropdown ===== */
.download-resume-dropdown { .download-resume-dropdown {
position: relative; position: relative;
width: 100%; width: fit-content;
} }
.download-resume-summary { .download-resume-summary {
@@ -706,8 +706,8 @@
cursor: pointer; cursor: pointer;
text-decoration: none; text-decoration: none;
transition: all var(--transition-fast); transition: all var(--transition-fast);
border: 1px solid var(--border); border: none;
background: transparent; width: 100%;
color: var(--accent); color: var(--accent);
list-style: none; list-style: none;
user-select: none; user-select: none;
@@ -745,7 +745,7 @@
position: absolute; position: absolute;
top: calc(100% + 4px); top: calc(100% + 4px);
left: 0; left: 0;
width: 100%; width: fit-content;
background: var(--bg-surface); background: var(--bg-surface);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 8px; border-radius: 8px;
@@ -767,6 +767,72 @@
background: var(--accent); background: var(--accent);
color: #fff; color: #fff;
} }
/* Shared wrapper for lazer + dropdown positioning context */
.download-resume-shared-wrapper {
position: relative;
display: flex;
flex-direction: column;
align-items: flex-start;
}
/* ===== Download Resume Lazer Border ===== */
.download-resume-lazer-wrapper {
position: relative;
padding: 2px;
width: fit-content;
overflow: hidden;
border-radius: calc(var(--radius-md) + 2px);
}
.download-resume-lazer-border {
position: absolute;
inset: -200%;
background: conic-gradient(
from 0deg,
transparent 60%,
var(--accent) 80%,
var(--accent-hover) 95%,
transparent 100%
);
animation: download-resume-lazer-spin 4s linear infinite;
pointer-events: none;
}
.download-resume-lazer-glow {
position: absolute;
inset: -200%;
background: conic-gradient(
from 0deg,
transparent 60%,
var(--accent) 80%,
var(--accent-hover) 95%,
transparent 100%
);
animation: download-resume-lazer-spin 4s linear infinite;
pointer-events: none;
filter: blur(12px);
opacity: 0.4;
}
.download-resume-lazer-inner {
position: relative;
z-index: 1;
width: 100%;
background: var(--bg-surface);
border-radius: var(--radius-md);
}
@keyframes download-resume-lazer-spin {
from { rotate: 0deg; }
to { rotate: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
.download-resume-lazer-border,
.download-resume-lazer-glow {
animation: none;
}
}
/* Desktop: show dropdown, hide mobile buttons */ /* Desktop: show dropdown, hide mobile buttons */
+33 -25
View File
@@ -56,31 +56,39 @@ function DownloadDropdown() {
return ( return (
<div ref={ref} className="download-resume-dropdown"> <div ref={ref} className="download-resume-dropdown">
<button <div className="download-resume-shared-wrapper">
className={`download-resume-summary ${open ? 'open' : ''}`} <div className="download-resume-lazer-wrapper">
onClick={() => setOpen(!open)} <div className="download-resume-lazer-border" />
type="button" <div className="download-resume-lazer-glow" />
> <div className="download-resume-lazer-inner">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="20" height="20"> <button
<path d="M12 3v10m0 0l-3-3m3 3l3-3" /> className={`download-resume-summary ${open ? 'open' : ''}`}
<path d="M3 17h18" /> onClick={() => setOpen(!open)}
</svg> type="button"
<span>Download Resume</span> >
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="16" height="16" className="chevron"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="20" height="20">
<polyline points="6 9 12 15 18 9" /> <path d="M12 3v10m0 0l-3-3m3 3l3-3" />
</svg> <path d="M3 17h18" />
</button> </svg>
<div className={`download-resume-options ${open ? 'open' : ''}`}> <span>Download Resume</span>
{resumeLanguages.map(lang => ( <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="16" height="16" className="chevron">
<a <polyline points="6 9 12 15 18 9" />
key={lang} </svg>
href={resumeUrlFor(lang)} </button>
download </div>
className="download-resume-option" </div>
> <div className={`download-resume-options ${open ? 'open' : ''}`}>
{langLabels[lang]} {resumeLanguages.map(lang => (
</a> <a
))} key={lang}
href={resumeUrlFor(lang)}
download
className="download-resume-option"
>
{langLabels[lang]}
</a>
))}
</div>
</div> </div>
</div> </div>
) )
+36 -28
View File
@@ -5,8 +5,8 @@ import { resumeAvailable, resumeLanguages, resumeUrlFor } from "@/data/resume"
import type { Language } from '@/types' import type { Language } from '@/types'
const langLabels: Record<Language, string> = { const langLabels: Record<Language, string> = {
en: 'EN', en: 'English',
vi: 'VI', vi: 'Tiếng Việt',
} }
function HeroDownloadDropdown() { function HeroDownloadDropdown() {
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
@@ -29,32 +29,40 @@ function HeroDownloadDropdown() {
return ( return (
<div ref={ref} className="download-resume-dropdown hero-download-dropdown"> <div ref={ref} className="download-resume-dropdown hero-download-dropdown">
<button <div className="download-resume-shared-wrapper">
className={`download-resume-summary hero-download-summary ${open ? 'open' : ''}`} <div className="download-resume-lazer-wrapper">
onClick={() => setOpen(!open)} <div className="download-resume-lazer-border" />
type="button" <div className="download-resume-lazer-glow" />
> <div className="download-resume-lazer-inner">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="18" height="18"> <button
<path d="M12 3v10m0 0l-3-3m3 3l3-3" /> className={`download-resume-summary hero-download-summary ${open ? 'open' : ''}`}
<path d="M3 17h18" /> onClick={() => setOpen(!open)}
</svg> type="button"
<span>Download Resume</span> >
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" className="chevron"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="18" height="18">
<polyline points="6 9 12 15 18 9" /> <path d="M12 3v10m0 0l-3-3m3 3l3-3" />
</svg> <path d="M3 17h18" />
</button> </svg>
<div className={`download-resume-options ${open ? 'open' : ''}`}> <span>Download Resume</span>
{resumeLanguages.map(lang => ( <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" className="chevron">
<a <polyline points="6 9 12 15 18 9" />
key={lang} </svg>
href={resumeUrlFor(lang)} </button>
download </div>
target="_blank" </div>
className="download-resume-option" <div className={`download-resume-options ${open ? 'open' : ''}`}>
> {resumeLanguages.map(lang => (
{langLabels[lang]} <a
</a> key={lang}
))} href={resumeUrlFor(lang)}
download
target="_blank"
className="download-resume-option"
>
{langLabels[lang]}
</a>
))}
</div>
</div> </div>
</div> </div>
) )