2026-10-13 00:24:12 +07:00
|
|
|
import { SectionHeading } from '@/components/ui/SectionHeading'
|
2026-10-06 23:42:49 +07:00
|
|
|
import { Link } from "react-router"
|
2026-10-06 19:29:13 +07:00
|
|
|
import { motion } from "motion/react"
|
|
|
|
|
import { Badge } from "@/components/ui/Badge"
|
|
|
|
|
import { projects } from "@/data/projects"
|
|
|
|
|
import { InView } from "@/components/ui/InView"
|
2026-10-14 11:15:48 +07:00
|
|
|
import { useLanguage } from '@/hooks/useLanguage'
|
|
|
|
|
import { strings } from '@/i18n/strings'
|
|
|
|
|
|
2026-10-06 23:42:49 +07:00
|
|
|
const MotionLink = motion.create(Link)
|
2026-10-06 11:42:11 +07:00
|
|
|
|
|
|
|
|
export function Projects() {
|
2026-10-14 11:15:48 +07:00
|
|
|
const { lang } = useLanguage()
|
2026-10-06 11:42:11 +07:00
|
|
|
const featured = projects.filter((p) => p.featured).slice(0, 4)
|
|
|
|
|
|
|
|
|
|
return (
|
2026-10-06 19:29:13 +07:00
|
|
|
<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 },
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
2026-10-14 11:15:48 +07:00
|
|
|
<SectionHeading title={strings.projects.featured[lang]} tag="04 - Projects" />
|
2026-10-13 00:24:12 +07:00
|
|
|
<Link
|
|
|
|
|
to="/projects"
|
|
|
|
|
style={{ fontSize: "14px", fontWeight: 500, color: "var(--accent)", display: "block", marginBottom: "24px" }}
|
2026-10-06 19:29:13 +07:00
|
|
|
>
|
2026-10-14 11:15:48 +07:00
|
|
|
{strings.projects.viewAll[lang]} →
|
2026-10-13 00:24:12 +07:00
|
|
|
</Link>
|
2026-10-06 19:29:13 +07:00
|
|
|
<div className="projects-grid">
|
|
|
|
|
{featured.map((project, i) => (
|
2026-10-06 23:42:49 +07:00
|
|
|
<MotionLink
|
2026-10-06 19:29:13 +07:00
|
|
|
key={project.id}
|
2026-10-06 23:42:49 +07:00
|
|
|
to={`/projects/${project.id}`}
|
2026-10-06 19:29:13 +07:00
|
|
|
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 }}
|
|
|
|
|
>
|
2026-10-13 00:24:12 +07:00
|
|
|
<div className="project-card-content">
|
|
|
|
|
<div className="project-card-header">
|
|
|
|
|
<h3>{project.title}</h3>
|
|
|
|
|
<Badge variant="outline">
|
2026-10-14 11:15:48 +07:00
|
|
|
{strings.projects.categories[project.category][lang]}
|
2026-10-13 00:24:12 +07:00
|
|
|
</Badge>
|
|
|
|
|
</div>
|
2026-10-14 11:15:48 +07:00
|
|
|
<p className="project-card-summary">{lang === 'vi' ? project.summary : project.summaryEn}</p>
|
2026-10-13 00:24:12 +07:00
|
|
|
<div className="project-card-techs">
|
|
|
|
|
{project.technologies.slice(0, 4).map((tech) => (
|
|
|
|
|
<span key={tech} className="tag">
|
|
|
|
|
{tech}
|
2026-10-06 19:29:13 +07:00
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-10-13 00:24:12 +07:00
|
|
|
{project.metrics && project.metrics.length > 0 && (
|
|
|
|
|
<div className="project-card-metrics">
|
|
|
|
|
{project.metrics.map((m) => (
|
|
|
|
|
<span key={m} className="achievement-metric">
|
|
|
|
|
{m}
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-10-14 11:15:48 +07:00
|
|
|
<span className="project-card-cta">{strings.projects.viewDetails[lang]} →</span>
|
2026-10-13 00:24:12 +07:00
|
|
|
</div>
|
2026-10-06 23:42:49 +07:00
|
|
|
</MotionLink>
|
2026-10-06 19:29:13 +07:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</motion.section>
|
|
|
|
|
</InView>
|
2026-10-06 11:42:11 +07:00
|
|
|
)
|
|
|
|
|
}
|