mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
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.
This commit is contained in:
1 parent
df65f4c774
commit
29a884fd4d
12 files changed
+46
-53
No files matched your search
@@ -4,7 +4,7 @@ import { skillGroups } from "@/data/skills"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField } from '@/i18n/useField'
|
||||
import { field } from '@/i18n/field'
|
||||
|
||||
export function Expertise() {
|
||||
const { lang } = useLanguage()
|
||||
@@ -34,7 +34,7 @@ export function Expertise() {
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<h3>{useField(group.title, group.titleEn)}</h3>
|
||||
<h3>{field(lang, group.title, group.titleEn)}</h3>
|
||||
<ul className="expertise-skills">
|
||||
{group.skills.map((skill) => (
|
||||
<li key={skill} className="expertise-skill">
|
||||
|
||||
Reference in new issue
Block a user