({ track }: Props)
| 8 | track: LearningTrack |
| 9 | } |
| 10 | export function LearningTrackCard({ track }: Props) { |
| 11 | const { locale } = useRouter() |
| 12 | const { t } = useTranslation('learning_track_nav') |
| 13 | const { trackTitle, trackName, nextGuide, trackProduct, numberOfGuides, currentGuideIndex } = |
| 14 | track |
| 15 | return ( |
| 16 | <div |
| 17 | data-testid="learning-track-card" |
| 18 | className="py-3 px-4 rounded color-bg-default border d-flex flex-justify-between mb-4 mx-2" |
| 19 | > |
| 20 | <div className="d-flex flex-column width-full"> |
| 21 | <Link href={`/${locale}/${trackProduct}/guides`} className="h4 color-fg-default mb-1"> |
| 22 | {trackTitle} |
| 23 | </Link> |
| 24 | <span className="f5 color-fg-muted"> |
| 25 | {t('current_progress') |
| 26 | .replace('{n}', numberOfGuides) |
| 27 | .replace('{i}', currentGuideIndex + 1)} |
| 28 | </span> |
| 29 | <hr /> |
| 30 | <span className="h5 color-fg-default"> |
| 31 | {nextGuide ? ( |
| 32 | <> |
| 33 | {t('next_guide')}: |
| 34 | <Link |
| 35 | href={`${nextGuide.href}?${new URLSearchParams({ |
| 36 | learn: trackName, |
| 37 | learnProduct: trackProduct, |
| 38 | })}`} |
| 39 | className="text-bold color-fg f5 ml-1" |
| 40 | > |
| 41 | {nextGuide.title} |
| 42 | </Link> |
| 43 | </> |
| 44 | ) : ( |
| 45 | <Link |
| 46 | href={`/${locale}/${trackProduct}/guides`} |
| 47 | className="h5 text-bold color-fg f5 ml-1" |
| 48 | > |
| 49 | {t('more_guides')} |
| 50 | </Link> |
| 51 | )} |
| 52 | </span> |
| 53 | </div> |
| 54 | </div> |
| 55 | ) |
| 56 | } |
nothing calls this directly
no test coverage detected