2026-10-06 19:29:13 +07:00
|
|
|
import { motion } from "motion/react"
|
|
|
|
|
import { SectionHeading } from "@/components/ui/SectionHeading"
|
2026-10-22 07:29:06 +07:00
|
|
|
import { InView } from '@/components/ui/InView'
|
2026-10-22 09:55:24 +07:00
|
|
|
import { EditableText } from '@/components/ui/EditableText'
|
2026-10-23 09:36:59 +07:00
|
|
|
import { TagListEditor } from '@/components/ui/TagListEditor'
|
|
|
|
|
import { RecordControls, AddGhost } from '@/components/ui/RecordControls'
|
|
|
|
|
import { useEdit } from '@/hooks/useEdit'
|
2026-10-22 07:29:06 +07:00
|
|
|
import { useI18n } from '@/i18n/provider'
|
2026-10-06 11:42:11 +07:00
|
|
|
|
|
|
|
|
export function Expertise() {
|
2026-10-22 07:29:06 +07:00
|
|
|
const { ui: s, content: c } = useI18n()
|
2026-10-23 09:36:59 +07:00
|
|
|
const edit = useEdit()
|
2026-10-06 11:42:11 +07:00
|
|
|
return (
|
2026-10-06 19:29:13 +07:00
|
|
|
<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 },
|
2026-10-17 20:02:47 +07:00
|
|
|
visible: { opacity: 1, transition: { duration: 0.5 } },
|
2026-10-06 19:29:13 +07:00
|
|
|
}}
|
|
|
|
|
>
|
2026-10-22 07:29:06 +07:00
|
|
|
<SectionHeading title={s.expertise.heading} tag={s.expertise.heading} />
|
2026-10-06 19:29:13 +07:00
|
|
|
<div className="expertise-grid">
|
2026-10-22 07:29:06 +07:00
|
|
|
{c.skillGroups.map((group, i) => (
|
2026-10-06 19:29:13 +07:00
|
|
|
<motion.div
|
2026-10-22 07:29:06 +07:00
|
|
|
key={group.id}
|
2026-10-23 09:36:59 +07:00
|
|
|
className={edit ? 'expertise-card edit-record-host' : 'expertise-card'}
|
2026-10-17 20:02:47 +07:00
|
|
|
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 }}
|
2026-10-06 19:29:13 +07:00
|
|
|
whileTap={{ scale: 0.98 }}
|
|
|
|
|
>
|
2026-10-23 09:36:59 +07:00
|
|
|
{edit && (
|
|
|
|
|
<RecordControls
|
|
|
|
|
label={group.title}
|
|
|
|
|
canUp={i > 0}
|
|
|
|
|
canDown={i < c.skillGroups.length - 1}
|
|
|
|
|
onUp={() => edit.moveItem('skills', '', i, i - 1)}
|
|
|
|
|
onDown={() => edit.moveItem('skills', '', i, i + 1)}
|
|
|
|
|
onDelete={() => edit.deleteRecord('skill-group', { id: group.id })}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2026-10-22 09:55:24 +07:00
|
|
|
<EditableText as="h3" path={`skills.${group.id}.title`} label={s.edit.fields.groupTitle}>
|
|
|
|
|
{group.title}
|
|
|
|
|
</EditableText>
|
2026-10-23 09:36:59 +07:00
|
|
|
<TagListEditor
|
|
|
|
|
doc="skills"
|
|
|
|
|
arrayPath={`[${i}].skills`}
|
|
|
|
|
items={group.skills}
|
|
|
|
|
containerAs="ul"
|
|
|
|
|
containerClassName="expertise-skills"
|
|
|
|
|
as="li"
|
|
|
|
|
itemClassName="expertise-skill"
|
|
|
|
|
labelPrefix={`${group.title} — ${s.edit.fields.skill}`}
|
|
|
|
|
addLabel={s.edit.addSkill}
|
|
|
|
|
/>
|
2026-10-06 19:29:13 +07:00
|
|
|
</motion.div>
|
|
|
|
|
))}
|
2026-10-23 09:36:59 +07:00
|
|
|
{edit && <AddGhost variant="card" label={s.edit.addSkillGroup} onClick={() => edit.addRecord('skill-group')} />}
|
2026-10-06 19:29:13 +07:00
|
|
|
</div>
|
|
|
|
|
</motion.section>
|
|
|
|
|
</InView>
|
2026-10-06 11:42:11 +07:00
|
|
|
)
|
|
|
|
|
}
|