added animation for home page

This commit is contained in:
dong.nguyen committed 2026-10-06 19:29:13 +07:00
1 parent 531c70e13a
commit 1800fa7ceb
15 files changed
+1289 -249

No files matched your search

+99 -37
View File
@@ -1,42 +1,104 @@
import { DownloadResume } from '@/components/sections/DownloadResume'
import { SectionHeading } from '@/components/ui/SectionHeading'
import { profile } from '@/data/profile'
import { motion } from "motion/react"
import { DownloadResume } from "@/components/sections/DownloadResume"
import { SectionHeading } from "@/components/ui/SectionHeading"
import { profile } from "@/data/profile"
import { InView } from "@/components/ui/InView"
export function Contact() {
return (
<section className="section container-content" aria-labelledby="contact-heading">
<SectionHeading title="Contact" />
<div className="contact-links">
<a href={`mailto:${profile.email}`} className="contact-link">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
<rect x="2" y="4" width="20" height="16" rx="2" />
<path d="M22 4l-10 8L2 4" />
</svg>
<div>
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>Email</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>{profile.email}</div>
</div>
</a>
<a href={profile.githubUrl} target="_blank" rel="noopener noreferrer" className="contact-link">
<svg viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
</svg>
<div>
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>GitHub</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>@yourusername</div>
</div>
</a>
<a href={profile.linkedinUrl} target="_blank" rel="noopener noreferrer" className="contact-link">
<svg viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
</svg>
<div>
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>LinkedIn</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>Your Name</div>
</div>
</a>
</div>
<DownloadResume />
</section>
<InView>
<motion.section
className="section container-content"
aria-labelledby="contact-heading"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.5 } },
}}
>
<SectionHeading title="Contact" />
<div className="contact-links">
<motion.a
href={`mailto:${profile.email}`}
className="contact-link"
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
width="24"
height="24"
>
<rect x="2" y="4" width="20" height="16" rx="2" />
<path d="M22 4l-10 8L2 4" />
</svg>
<div>
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
Email
</div>
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
{profile.email}
</div>
</div>
</motion.a>
<motion.a
href={profile.githubUrl}
target="_blank"
rel="noopener noreferrer"
className="contact-link"
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
<svg
viewBox="0 0 24 24"
fill="currentColor"
width="24"
height="24"
>
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
</svg>
<div>
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
GitHub
</div>
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
@yourusername
</div>
</div>
</motion.a>
<motion.a
href={profile.linkedinUrl}
target="_blank"
rel="noopener noreferrer"
className="contact-link"
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
<svg
viewBox="0 0 24 24"
fill="currentColor"
width="24"
height="24"
>
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
</svg>
<div>
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
LinkedIn
</div>
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
Your Name
</div>
</div>
</motion.a>
</div>
<DownloadResume />
</motion.section>
</InView>
)
}
+95 -47
View File
@@ -1,56 +1,104 @@
import { experiences } from '@/data/experience'
import { motion } from "motion/react"
import { experiences } from "@/data/experience"
import { InView } from "@/components/ui/InView"
export function Experience() {
return (
<section className="section container-content" aria-labelledby="experience-heading">
<h2 id="experience-heading" style={{ marginBottom: '48px' }}>
Experience
</h2>
<div className="timeline">
{experiences.map((exp) => (
<div key={exp.id} className="timeline-entry">
<div className="timeline-marker" />
<div className="timeline-header">
<div className="timeline-title">{exp.title}</div>
<div className="timeline-company">{exp.company}</div>
<div className="timeline-duration">{exp.duration}</div>
{exp.location && (
<div className="timeline-duration">{exp.location}</div>
)}
</div>
<ul className="timeline-responsibilities">
{exp.responsibilities.map((r) => (
<li key={r}>{r}</li>
))}
</ul>
{exp.achievements?.map((achievement) => (
<div key={achievement.id} className="achievement">
<div className="achievement-title">{achievement.title}</div>
<div className="achievement-context">{achievement.context}</div>
<div style={{ fontSize: '14px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
{achievement.impact}
</div>
{achievement.metrics && achievement.metrics.length > 0 && (
<div style={{ marginBottom: '8px' }}>
{achievement.metrics.map((m) => (
<span key={m} className="achievement-metric">
{m}
<InView>
<motion.section
className="section container-content"
aria-labelledby="experience-heading"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: { staggerChildren: 0.15 },
},
}}
>
<motion.h2
id="experience-heading"
style={{ marginBottom: "48px" }}
variants={{
hidden: { opacity: 0, y: 30 },
visible: { opacity: 1, y: 0, transition: { duration: 0.5 } },
}}
>
Experience
</motion.h2>
<div className="timeline">
{experiences.map((exp, i) => (
<motion.div
key={exp.id}
className="timeline-entry"
variants={{
hidden: { opacity: 0, y: 30 },
visible: {
opacity: 1,
y: 0,
transition: { duration: 0.5, delay: i * 0.15 },
},
}}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<div className="timeline-marker" />
<div className="timeline-header">
<div className="timeline-title">{exp.title}</div>
<div className="timeline-company">{exp.company}</div>
<div className="timeline-duration">{exp.duration}</div>
{exp.location && (
<div className="timeline-duration">{exp.location}</div>
)}
</div>
<ul className="timeline-responsibilities">
{exp.responsibilities.map((r) => (
<li key={r}>{r}</li>
))}
</ul>
{exp.achievements?.map((achievement) => (
<div key={achievement.id} className="achievement">
<div className="achievement-title">
{achievement.title}
</div>
<div className="achievement-context">
{achievement.context}
</div>
<div
style={{
fontSize: "14px",
color: "var(--text-secondary)",
marginBottom: "8px",
}}
>
{achievement.impact}
</div>
{achievement.metrics &&
achievement.metrics.length > 0 && (
<div style={{ marginBottom: "8px" }}>
{achievement.metrics.map((m) => (
<span key={m} className="achievement-metric">
{m}
</span>
))}
</div>
)}
<div className="achievement-techs">
{achievement.technologies.map((tech) => (
<span key={tech} className="tag">
{tech}
</span>
))}
</div>
)}
<div className="achievement-techs">
{achievement.technologies.map((tech) => (
<span key={tech} className="tag">
{tech}
</span>
))}
</div>
</div>
))}
</div>
))}
</div>
</section>
))}
</motion.div>
))}
</div>
</motion.section>
</InView>
)
}
+49 -19
View File
@@ -1,24 +1,54 @@
import { SectionHeading } from '@/components/ui/SectionHeading'
import { skillGroups } from '@/data/skills'
import { motion } from "motion/react"
import { SectionHeading } from "@/components/ui/SectionHeading"
import { skillGroups } from "@/data/skills"
import { InView } from "@/components/ui/InView"
export function Expertise() {
return (
<section className="section container-wide" aria-labelledby="expertise-heading">
<SectionHeading title="Core Expertise" />
<div className="expertise-grid">
{skillGroups.map((group) => (
<div key={group.title} className="expertise-card">
<h3>{group.title}</h3>
<ul className="expertise-skills">
{group.skills.map((skill) => (
<li key={skill} className="expertise-skill">
{skill}
</li>
))}
</ul>
</div>
))}
</div>
</section>
<InView>
<motion.section
className="section container-wide"
aria-labelledby="expertise-heading"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: { staggerChildren: 0.1 },
},
}}
>
<SectionHeading title="Core Expertise" />
<div className="expertise-grid">
{skillGroups.map((group, i) => (
<motion.div
key={group.title}
className="expertise-card"
variants={{
hidden: { opacity: 0, y: 30 },
visible: {
opacity: 1,
y: 0,
transition: { duration: 0.5, delay: i * 0.1 },
},
}}
whileHover={{ scale: 1.05, y: -2 }}
whileTap={{ scale: 0.98 }}
>
<h3>{group.title}</h3>
<ul className="expertise-skills">
{group.skills.map((skill) => (
<li key={skill} className="expertise-skill">
{skill}
</li>
))}
</ul>
</motion.div>
))}
</div>
</motion.section>
</InView>
)
}
+65 -23
View File
@@ -1,14 +1,15 @@
import { OpenToWorkBadge } from '@/components/ui/OpenToWorkBadge'
import { resumeAvailable } from '@/data/resume'
import { Button } from '@/components/ui/Button'
import { SocialLinks } from '@/components/ui/SocialLinks'
import { profile } from '@/data/profile'
import { motion } from "motion/react"
import { OpenToWorkBadge } from "@/components/ui/OpenToWorkBadge"
import { resumeAvailable } from "@/data/resume"
import { Button } from "@/components/ui/Button"
import { SocialLinks } from "@/components/ui/SocialLinks"
import { profile } from "@/data/profile"
const socialLinks = [
{
label: 'GitHub',
label: "GitHub",
href: profile.githubUrl,
'aria-label': 'View GitHub profile',
"aria-label": "View GitHub profile",
icon: (
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
@@ -16,9 +17,9 @@ const socialLinks = [
),
},
{
label: 'LinkedIn',
label: "LinkedIn",
href: profile.linkedinUrl,
'aria-label': 'View LinkedIn profile',
"aria-label": "View LinkedIn profile",
icon: (
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
@@ -26,9 +27,9 @@ const socialLinks = [
),
},
{
label: 'Email',
label: "Email",
href: `mailto:${profile.email}`,
'aria-label': 'Send email',
"aria-label": "Send email",
icon: (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="20" height="20">
<rect x="2" y="4" width="20" height="16" rx="2" />
@@ -40,14 +41,50 @@ const socialLinks = [
export function Hero() {
return (
<section className="hero container-wide" aria-labelledby="hero-heading">
<div className="hero-content">
<h1 id="hero-heading" className="hero-name">
<motion.section
className="hero container-wide"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3 }}
aria-labelledby="hero-heading"
>
<motion.div
className="hero-content"
initial={{ opacity: 0, x: -30 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: 0.6, delay: 0.2 }}
>
<motion.h1
id="hero-heading"
className="hero-name"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: 0.3 }}
>
{profile.name}
</h1>
<p className="hero-title">{profile.title}</p>
<p className="hero-tagline">{profile.tagline}</p>
<div className="hero-cta">
</motion.h1>
<motion.p
className="hero-title"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: 0.4 }}
>
{profile.title}
</motion.p>
<motion.p
className="hero-tagline"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: 0.5 }}
>
{profile.tagline}
</motion.p>
<motion.div
className="hero-cta"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: 0.6 }}
>
<Button href="/projects" variant="primary">
View Projects
</Button>
@@ -59,17 +96,22 @@ export function Hero() {
<Button href="/contact" variant="secondary">
Contact Me
</Button>
</div>
</motion.div>
<SocialLinks links={socialLinks} />
</div>
<div className="hero-visual">
</motion.div>
<motion.div
className="hero-visual"
initial={{ opacity: 0, x: 30 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: 0.6, delay: 0.4 }}
>
<img
src="/profile-photo.webp"
alt="Profile photo"
className="hero-photo"
/>
<OpenToWorkBadge />
</div>
</section>
</motion.div>
</motion.section>
)
}
+89 -46
View File
@@ -1,60 +1,103 @@
import { Badge } from '@/components/ui/Badge'
import { projects } from '@/data/projects'
import { motion } from "motion/react"
import { Badge } from "@/components/ui/Badge"
import { projects } from "@/data/projects"
import { InView } from "@/components/ui/InView"
const categoryLabels: Record<string, string> = {
'software-engineering': 'Software Engineering',
logistics: 'Logistics',
'ai-ml': 'AI / ML',
'computer-vision': 'Computer Vision',
architecture: 'Architecture',
experiment: 'Experiment',
"software-engineering": "Software Engineering",
logistics: "Logistics",
"ai-ml": "AI / ML",
"computer-vision": "Computer Vision",
architecture: "Architecture",
experiment: "Experiment",
}
export function Projects() {
const featured = projects.filter((p) => p.featured).slice(0, 4)
return (
<section className="section container-wide" aria-labelledby="projects-heading">
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: '48px' }}>
<h2 id="projects-heading">Featured Projects</h2>
<a href="/projects" style={{ fontSize: '14px', fontWeight: 500, color: 'var(--accent)' }}>
View All →
</a>
</div>
<div className="projects-grid">
{featured.map((project) => (
<a
key={project.id}
href={`/projects/${project.id}`}
className="project-card"
<InView>
<motion.section
className="section container-wide"
aria-labelledby="projects-heading"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.1 }}
variants={{
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: { staggerChildren: 0.1 },
},
}}
>
<motion.div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "baseline",
marginBottom: "48px",
}}
variants={{
hidden: { opacity: 0, y: 30 },
visible: { opacity: 1, y: 0, transition: { duration: 0.5 } },
}}
>
<h2 id="projects-heading">Featured Projects</h2>
<motion.a
href="/projects"
style={{ fontSize: "14px", fontWeight: 500, color: "var(--accent)" }}
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
<div className="project-card-header">
<h3>{project.title}</h3>
<Badge variant="outline">
{categoryLabels[project.category] || project.category}
</Badge>
</div>
<p className="project-card-summary">{project.summary}</p>
<div className="project-card-techs">
{project.technologies.slice(0, 4).map((tech) => (
<span key={tech} className="tag">
{tech}
</span>
))}
</div>
{project.metrics && project.metrics.length > 0 && (
<div className="project-card-metrics">
{project.metrics.map((m) => (
<span key={m} className="achievement-metric">
{m}
View All →
</motion.a>
</motion.div>
<div className="projects-grid">
{featured.map((project, i) => (
<motion.a
key={project.id}
href={`/projects/${project.id}`}
className="project-card"
variants={{
hidden: { opacity: 0, y: 30 },
visible: {
opacity: 1,
y: 0,
transition: { duration: 0.5, delay: i * 0.1 },
},
}}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<div className="project-card-header">
<h3>{project.title}</h3>
<Badge variant="outline">
{categoryLabels[project.category] || project.category}
</Badge>
</div>
<p className="project-card-summary">{project.summary}</p>
<div className="project-card-techs">
{project.technologies.slice(0, 4).map((tech) => (
<span key={tech} className="tag">
{tech}
</span>
))}
</div>
)}
<span className="project-card-cta">View Details →</span>
</a>
))}
</div>
</section>
{project.metrics && project.metrics.length > 0 && (
<div className="project-card-metrics">
{project.metrics.map((m) => (
<span key={m} className="achievement-metric">
{m}
</span>
))}
</div>
)}
<span className="project-card-cta">View Details →</span>
</motion.a>
))}
</div>
</motion.section>
</InView>
)
}
+50 -24
View File
@@ -1,10 +1,11 @@
import { forwardRef } from 'react'
import type { ComponentPropsWithoutRef } from 'react'
import { motion } from "motion/react"
import { forwardRef } from "react"
import type { ComponentPropsWithoutRef } from "react"
type ButtonVariant = 'primary' | 'secondary' | 'ghost'
type ButtonSize = 'sm' | 'md' | 'lg'
type ButtonVariant = "primary" | "secondary" | "ghost"
type ButtonSize = "sm" | "md" | "lg"
interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
variant?: ButtonVariant
size?: ButtonSize
href?: string
@@ -13,36 +14,61 @@ interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
}
const variantClasses: Record<ButtonVariant, string> = {
primary: 'btn btn-primary',
secondary: 'btn btn-secondary',
ghost: 'btn btn-ghost',
primary: "btn btn-primary",
secondary: "btn btn-secondary",
ghost: "btn btn-ghost",
}
const sizeClasses: Record<ButtonSize, string> = {
sm: 'btn-sm',
md: '',
lg: 'btn-lg',
sm: "btn-sm",
md: "",
lg: "btn-lg",
}
export const Button = forwardRef<
HTMLButtonElement | HTMLAnchorElement,
ButtonProps
>(({ variant = 'primary', size = 'md', href, className = '', children, ...props }, ref) => {
const classes = `${variantClasses[variant]} ${sizeClasses[size]} ${className}`.trim()
>(
(
{
variant = "primary",
size = "md",
href,
className = "",
children,
...props
},
ref
) => {
const classes = `${variantClasses[variant]} ${sizeClasses[size]} ${className}`.trim()
if (href) {
return (
<motion.a
href={href}
className={classes}
ref={ref as React.Ref<HTMLAnchorElement>}
whileTap={{ scale: 0.95 }}
{...(props as Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof ButtonProps>)}
>
{children}
</motion.a>
)
}
if (href) {
return (
<a href={href} className={classes} ref={ref as React.Ref<HTMLAnchorElement>} {...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}>
<motion.button
className={classes}
ref={ref as React.Ref<HTMLButtonElement>}
whileTap={{ scale: 0.95 }}
{...(props as Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonProps>)}
>
{children}
</a>
</motion.button>
)
}
)
return (
<button className={classes} ref={ref as React.Ref<HTMLButtonElement>} {...props}>
{children}
</button>
)
})
Button.displayName = 'Button'
Button.displayName = "Button"
+30
View File
@@ -0,0 +1,30 @@
import { motion, type MotionProps } from "motion/react"
import type { ReactNode } from "react"
interface InViewProps extends Omit<MotionProps, "children"> {
children: ReactNode
delay?: number
threshold?: number
className?: string
}
export function InView({
children,
delay = 0,
threshold = 0.1,
className,
...props
}: InViewProps) {
return (
<motion.div
className={className}
initial={{ opacity: 0, y: 30 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: threshold }}
transition={{ duration: 0.5, delay }}
{...props}
>
{children}
</motion.div>
)
}
+27 -17
View File
@@ -1,23 +1,33 @@
import { profile } from '@/data/profile'
import { motion } from "motion/react"
export function OpenToWorkBadge() {
return (
<div className="otw-badge" role="status" aria-label="Open to work">
<svg
className="otw-icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2.5"
strokeLinecap="round"
strokeLinejoin="round"
width="16"
height="16"
>
<polyline points="20 6 9 17 4 12" />
<motion.div
className="otw-container"
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3, duration: 0.5 }}
role="status"
aria-label="Open to work"
>
<svg className="otw-spring" viewBox="0 0 60 120">
<motion.path
d="M 30 0 C 50 5, 50 15, 30 20 C 10 25, 10 35, 30 40 C 50 45, 50 55, 30 60 C 10 65, 10 75, 30 80 C 50 85, 50 95, 30 100 C 10 105, 10 115, 30 120 L 30 125"
stroke="var(--accent)"
fill="none"
strokeWidth="2"
strokeLinecap="round"
animate={{ rotate: [-8, 8, -8] }}
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
/>
</svg>
<span className="otw-title">Open to Work</span>
<span className="otw-subtitle">{profile.title}</span>
</div>
<motion.div
className="otw-badge"
animate={{ rotate: [-8, 8, -8] }}
transition={{ duration: 3, repeat: Infinity, ease: "easeInOut" }}
>
<span>#OpenToWork</span>
</motion.div>
</motion.div>
)
}
+9 -5
View File
@@ -1,8 +1,10 @@
import { motion } from "motion/react"
interface SocialLink {
label: string
href: string
icon: React.ReactNode
'aria-label': string
"aria-label": string
}
interface SocialLinksProps {
@@ -10,21 +12,23 @@ interface SocialLinksProps {
className?: string
}
export function SocialLinks({ links, className = '' }: SocialLinksProps) {
export function SocialLinks({ links, className = "" }: SocialLinksProps) {
return (
<div className={`social-links ${className}`}>
{links.map((link) => (
<a
<motion.a
key={link.label}
href={link.href}
target="_blank"
rel="noopener noreferrer"
className="social-link"
aria-label={link['aria-label']}
aria-label={link["aria-label"]}
whileHover={{ scale: 1.1 }}
whileTap={{ scale: 0.9 }}
>
{link.icon}
<span>{link.label}</span>
</a>
</motion.a>
))}
</div>
)