---
import Divider from '@/components/divider.astro';
import SectionCard from '@/components/section-card.astro';
import type { EducationSection } from '@/types/education-section';
import type { I18n } from '@/types/i18n';
import removeLast from '@/utils/remove-last';

import EducationItem from './education-item.astro';

export interface Props extends EducationSection {
  i18n: I18n;
}

const {
  config: { title },
  educationItems,
  i18n,
} = Astro.props;
---

<SectionCard section="education" title={title}>
  {
    removeLast(
      educationItems.flatMap((educationItem) => [
        <EducationItem i18n={i18n} educationItem={educationItem} />,
        <Divider />,
      ])
    )
  }
</SectionCard>
