22import { ChevronDownIcon , ChevronUpIcon } from '@primer/octicons-react'
33import { Details , Timeline , Token , useDetails } from '@primer/react'
44import { Link } from '@/frame/components/Link'
5+ import { useTranslation } from '@/languages/components/useTranslation'
56import { JourneyTrack } from '@/journeys/lib/journey-path-resolver'
67import styles from './JourneyLearningTracks.module.scss'
78
@@ -10,6 +11,8 @@ type JourneyLearningTracksProps = {
1011}
1112
1213export const JourneyLearningTracks = ( { tracks } : JourneyLearningTracksProps ) => {
14+ const { t } = useTranslation ( 'journey_landing' )
15+
1316 if ( ! tracks || tracks . length === 0 ) {
1417 return null
1518 }
@@ -26,7 +29,7 @@ export const JourneyLearningTracks = ({ tracks }: JourneyLearningTracksProps) =>
2629 >
2730 < summary className = { styles . trackSummary } >
2831 < div className = { styles . trackHeader } >
29- < h3 className = "h4 text-bold" > { track . title } </ h3 >
32+ < h2 className = "h4 text-bold" > { track . title } </ h2 >
3033 < Token text = { `${ track . guides ?. length || 0 } articles` } />
3134 </ div >
3235 < div className = { styles . trackDescription } >
@@ -49,6 +52,29 @@ export const JourneyLearningTracks = ({ tracks }: JourneyLearningTracksProps) =>
4952 )
5053 }
5154
55+ // simple single journey
56+ if ( tracks . length === 1 ) {
57+ const track = tracks [ 0 ]
58+
59+ return (
60+ < div data-testid = "journey-single-track" >
61+ < div className = { styles . trackHeader } >
62+ < h2 className = "h1 text-bold mb-4" > { t ( 'articles_heading' ) } </ h2 >
63+ </ div >
64+ < ol className = { `${ styles . trackGuides } pl-0` } data-testid = "journey-articles" >
65+ { ( track . guides || [ ] ) . map ( ( article : { href : string ; title : string } ) => (
66+ < li key = { article . href } >
67+ < Link href = { article . href } className = "f4 text-semibold" >
68+ { article . title }
69+ </ Link >
70+ </ li >
71+ ) ) }
72+ </ ol >
73+ </ div >
74+ )
75+ }
76+
77+ // more than one journey has timeline and mobile layout
5278 return (
5379 < div data-testid = "journey-tracks" >
5480 { /* Desktop: Timeline component */ }
0 commit comments