mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
89 lines
3.1 KiB
TypeScript
89 lines
3.1 KiB
TypeScript
import { SectionHeading } from '@/components/ui/SectionHeading'
|
|
import { Link } from "react-router"
|
|
import { motion } from "motion/react"
|
|
import { Badge } from "@/components/ui/Badge"
|
|
import { projects } from "@/data/projects"
|
|
import { InView } from "@/components/ui/InView"
|
|
import { useLanguage } from '@/hooks/useLanguage'
|
|
import { strings } from '@/i18n/strings'
|
|
|
|
const MotionLink = motion.create(Link)
|
|
|
|
export function Projects() {
|
|
const { lang } = useLanguage()
|
|
const featured = projects.filter((p) => p.featured).slice(0, 4)
|
|
|
|
return (
|
|
<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 },
|
|
},
|
|
}}
|
|
>
|
|
<SectionHeading title={strings.projects.featured[lang]} tag="04 - Projects" />
|
|
<Link
|
|
to="/projects"
|
|
style={{ fontSize: "14px", fontWeight: 500, color: "var(--accent)", display: "block", marginBottom: "24px" }}
|
|
>
|
|
{strings.projects.viewAll[lang]} →
|
|
</Link>
|
|
<div className="projects-grid">
|
|
{featured.map((project, i) => (
|
|
<MotionLink
|
|
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 },
|
|
},
|
|
}}
|
|
whileHover={{ scale: 1.02, y: -4 }}
|
|
whileTap={{ scale: 0.98 }}
|
|
>
|
|
<div className="project-card-content">
|
|
<div className="project-card-header">
|
|
<h3>{project.title}</h3>
|
|
<Badge variant="outline">
|
|
{strings.projects.categories[project.category][lang]}
|
|
</Badge>
|
|
</div>
|
|
<p className="project-card-summary">{lang === 'vi' ? project.summary : project.summaryEn}</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}
|
|
</span>
|
|
))}
|
|
</div>
|
|
)}
|
|
<span className="project-card-cta">{strings.projects.viewDetails[lang]} →</span>
|
|
</div>
|
|
</MotionLink>
|
|
))}
|
|
</div>
|
|
</motion.section>
|
|
</InView>
|
|
)
|
|
}
|