forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLearningTrackNav.tsx
44 lines (42 loc) · 1.34 KB
/
LearningTrackNav.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { LearningTrack } from 'components/context/ArticleContext'
import { useTranslation } from 'components/hooks/useTranslation'
type Props = {
track: LearningTrack
}
export function LearningTrackNav({ track }: Props) {
const { t } = useTranslation('learning_track_nav')
const { prevGuide, nextGuide, trackName, trackProduct } = track
return (
<div
data-testid="learning-track-nav"
className="py-3 px-4 rounded color-bg-default border d-flex flex-justify-between"
>
<span className="d-flex flex-column">
{prevGuide && (
<>
<span className="f6 color-fg-muted">{t('prevGuide')}</span>
<a
href={`${prevGuide.href}?learn=${trackName}&learnProduct=${trackProduct}`}
className="text-bold color-fg-muted"
>
{prevGuide.title}
</a>
</>
)}
</span>
<span className="d-flex flex-column flex-items-end">
{nextGuide && (
<>
<span className="f6 color-fg-muted">{t('nextGuide')}</span>
<a
href={`${nextGuide.href}?learn=${trackName}&learnProduct=${trackProduct}`}
className="text-bold color-fg-muted text-right f4"
>
{nextGuide.title}
</a>
</>
)}
</span>
</div>
)
}