Skip to content

Commit c5a9780

Browse files
authored
one-off journey landing design when only 1 journey (#58699)
1 parent 7638d1a commit c5a9780

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

data/ui.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ footer:
258258
machine: Some of this content may be machine- or AI-translated.
259259
journey_landing:
260260
articles: '{{ number }} Articles'
261+
articles_heading: Articles
261262
product_landing:
262263
article_grid:
263264
heading: Articles

src/fixtures/fixtures/data/ui.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ footer:
258258
machine: Some of this content may be machine- or AI-translated.
259259
journey_landing:
260260
articles: '{{ number }} Articles'
261+
articles_heading: Articles
261262
product_landing:
262263
article_grid:
263264
heading: Articles

src/fixtures/tests/playwright-rendering.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ test.describe('Journey Tracks', () => {
10711071

10721072
// Verify track has proper structure
10731073
const firstTrack = tracks.first()
1074-
await expect(firstTrack.locator('h3')).toBeVisible() // Track title
1074+
await expect(firstTrack.locator('h2')).toBeVisible() // Track title
10751075
await expect(firstTrack.locator('p')).toBeVisible() // Track description
10761076
})
10771077

src/landings/components/journey/JourneyLearningTracks.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { ChevronDownIcon, ChevronUpIcon } from '@primer/octicons-react'
33
import { Details, Timeline, Token, useDetails } from '@primer/react'
44
import { Link } from '@/frame/components/Link'
5+
import { useTranslation } from '@/languages/components/useTranslation'
56
import { JourneyTrack } from '@/journeys/lib/journey-path-resolver'
67
import styles from './JourneyLearningTracks.module.scss'
78

@@ -10,6 +11,8 @@ type JourneyLearningTracksProps = {
1011
}
1112

1213
export 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

Comments
 (0)