import React from 'react';
import { getCurriculumContentSubTypeText, getCurriculumIcon } from '@/utils/curriculum.utils';
import CurriculumItemTitle from './curriculum-item-title';

interface SectionTitleProps {
  title: string;
  duration?: number;
  icon?: string;
  type: string;
  color?: string;
}

function SectionCommonItem({
  title,
  duration,
  icon,
  type,
  color = 'gray',
}: SectionTitleProps): React.ReactNode {
  const IconComp = getCurriculumIcon({ type, icon });

  return (
    <>
      <IconComp color={color} />
      <CurriculumItemTitle duration={duration} subText={getCurriculumContentSubTypeText(type)} title={title} />
    </>
  );
}

export default SectionCommonItem;
