import { useLanguage } from '../../contexts/LanguageContext'; import type { Skill } from '../../data/Skill'; interface SkillCategory { title: string; skills: Skill[]; } interface SkillsSectionProps { title?: string; subtitle?: string; skillCategories?: SkillCategory[]; } // Helper function to calculate skill level based on value const calculateSkillLevel = (value: number): string => { if (value >= 90) return "Expert"; if (value >= 75) return "Advanced"; if (value >= 50) return "Intermediate"; return "Beginner"; }; // Helper function to get color based on array position const getColorByPosition = (index: number): string => { const colors = ["primary", "secondary", "tertiary", "quaternary", "quinary", "senary"]; return colors[index % colors.length]; }; export default function SkillsSection(props: SkillsSectionProps = {}) { const { texts: allTexts } = useLanguage(); const texts = allTexts.skills; const accessibilityTexts = allTexts.accessibility; // Use centralized texts as defaults, allow props to override const { title = texts.title, subtitle = texts.subtitle, skillCategories = texts.skillCategories } = props; return (
{/* Section Header */}

{title}

{subtitle}

{/* Skip link for keyboard navigation */}
{accessibilityTexts.skipLinks.skipToCertifications}
{/* Skills Grid */}
{skillCategories.map((category, categoryIndex) => { const colorClass = getColorByPosition(categoryIndex); return (
{category.title}

{category.title}

Skill category {categoryIndex + 1} of {skillCategories.length}. Contains {category.skills.length} skills.
    {category.skills.map((skillItem, skillIndex) => { const displayLevel = calculateSkillLevel(skillItem.value); return (
  • {skillItem.skill}

    {displayLevel}
    {/* Screen reader description */}
    Skill {skillIndex + 1} of {category.skills.length} in {category.title}. Proficiency level: {displayLevel} at {skillItem.value} percent.
  • ); })}
); })}
{/* Skills summary for screen readers */}

Skills overview: {skillCategories.length} categories with a total of{' '} {skillCategories.reduce((total, category) => total + category.skills.length, 0)} skills. Use Tab to navigate between categories and individual skills.

); }