mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
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.
52 lines
1.8 KiB
TypeScript
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>
|
|
)
|
|
}
|