Files
cv/src/components/sections/Expertise.tsx
T
dong.nguyen 29a884fd4d fix(i18n): resolve bilingual data through a pure field() helper
useField and useFieldArray were hooks called from inside .map() callbacks - 11 rules-of-hooks errors. field(lang, value, valueEn) is a plain function, so the same selection is legal in a callback, with lang read once at component top level. One helper covers scalar and array values because both need the same lockstep rule. resolvedTheme is now theme directly: resolveTheme() was an identity helper left behind by the removed system variant.
2026-10-18 23:45:19 +07:00

52 lines
1.8 KiB
TypeScript

import { motion } from "motion/react"
import { SectionHeading } from "@/components/ui/SectionHeading"
import { skillGroups } from "@/data/skills"
import { InView } from "@/components/ui/InView"
import { useLanguage } from '@/hooks/useLanguage'
import { strings } from '@/i18n/strings'
import { field } from '@/i18n/field'
export function Expertise() {
const { lang } = useLanguage()
return (
<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: { duration: 0.5 } },
}}
>
<SectionHeading title={strings.expertise.heading[lang]} tag={strings.expertise.heading[lang]} />
<div className="expertise-grid">
{skillGroups.map((group, i) => (
<motion.div
key={group.title}
className="expertise-card"
initial={{ opacity: 0, y: 24 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.2 }}
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
whileHover={{ scale: 1.02, y: -4 }}
whileTap={{ scale: 0.98 }}
>
<h3>{field(lang, group.title, group.titleEn)}</h3>
<ul className="expertise-skills">
{group.skills.map((skill) => (
<li key={skill} className="expertise-skill">
{skill}
</li>
))}
</ul>
</motion.div>
))}
</div>
</motion.section>
</InView>
)
}