import { useTranslation } from 'components/hooks/useTranslation' import { ArrowRightIcon } from '@primer/octicons-react' import { useState } from 'react' import { FeaturedTrack } from 'components/context/ProductSubLandingContext' type Props = { track: FeaturedTrack } const MAX_VISIBLE_GUIDES = 4 export const LearningTrack = ({ track }: Props) => { const [visibleGuides, setVisibleGuides] = useState(track?.guides?.slice(0, 4)) const showAll = () => { setVisibleGuides(track?.guides) } const { t } = useTranslation('product_sublanding') return (
{track?.title}

{track?.description}

{t('start')}
{visibleGuides?.map((guide) => (
{track?.guides && ( {track.guides?.indexOf(guide) + 1} )}
{guide.title}
{t('guide_types')[guide.page.type]}
{track?.guides && track?.guides?.indexOf(guide) + 1 === MAX_VISIBLE_GUIDES ? ( ) : (
)}
))}
) }