1
0
mirror of synced 2025-12-22 11:26:57 -05:00
Files
docs/components/sidebar/AllProductsLink.tsx
Robert Sese c5f9788223 Version the 'All products' link (#24972)
* Don't show link no matter what version you're on

* Maintain current version in link

* No 'All products' link on homepage for all versions
2022-02-03 16:31:05 +00:00

22 lines
645 B
TypeScript

import { useRouter } from 'next/router'
import { ArrowLeftIcon } from '@primer/octicons-react'
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
export const AllProductsLink = () => {
const router = useRouter()
const { currentVersion } = useVersion()
const currentVersionPathSegment = currentVersion === DEFAULT_VERSION ? '' : `/${currentVersion}`
return (
<li>
<a
href={`/${router.locale}${currentVersionPathSegment}`}
className="f6 pl-4 pr-5 ml-n1 pb-1 color-fg-default"
>
<ArrowLeftIcon size="small" className="mr-1" />
All products
</a>
</li>
)
}