1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/components/article/LearningTrackNav.tsx
Robert Sese 000799df17 Handle learning track paths from a different product (#21776)
* Add trackProduct property

* Fall back to learning track product URL param

* Add product URL param to learning track banner

* Add product URL param to featured track links

* Fix typo :(

* Add product URL param to learning track

* Add multi-product learning track tests

* Re-enable tests with a Code Security learning track

* Re-enable more tests with Code Security learning tracks

* Add more multi-product testing

* Update components/sublanding/LearningTrack.tsx

Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>

Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
2021-09-30 21:17:02 +00:00

45 lines
1.4 KiB
TypeScript

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-primary border d-flex flex-justify-between"
>
<span className="d-flex flex-column">
{prevGuide && (
<>
<span className="f6 color-text-secondary">{t('prevGuide')}</span>
<a
href={`${prevGuide.href}?learn=${trackName}&learnProduct=${trackProduct}`}
className="text-bold color-text-secondary"
>
{prevGuide.title}
</a>
</>
)}
</span>
<span className="d-flex flex-column flex-items-end">
{nextGuide && (
<>
<span className="f6 color-text-secondary">{t('nextGuide')}</span>
<a
href={`${nextGuide.href}?learn=${trackName}&learnProduct=${trackProduct}`}
className="text-bold color-text-secondary text-right f4"
>
{nextGuide.title}
</a>
</>
)}
</span>
</div>
)
}