-
Notifications
You must be signed in to change notification settings - Fork 59.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8997 from github/repo-sync
repo sync
- Loading branch information
Showing
15 changed files
with
223 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useRouter } from 'next/router' | ||
import { LinkExternalIcon } from '@primer/octicons-react' | ||
|
||
import { useVersion } from 'components/hooks/useVersion' | ||
import { useMainContext } from 'components/context/MainContext' | ||
import { Link } from 'components/Link' | ||
|
||
import { AllProductsLink } from './AllProductsLink' | ||
|
||
export const SidebarHomepage = () => { | ||
const router = useRouter() | ||
const { currentVersion } = useVersion() | ||
const { activeProducts, isFPT } = useMainContext() | ||
|
||
return ( | ||
<ul data-testid="sidebar" className="mt-4"> | ||
{!isFPT && <AllProductsLink />} | ||
|
||
{activeProducts.map((product) => { | ||
if (!isFPT && !product.versions?.includes(currentVersion) && !product.external) { | ||
return null | ||
} | ||
|
||
const href = `${!product.external ? `/${router.locale}` : ''}${ | ||
product.versions?.includes(currentVersion) && !isFPT | ||
? `/${currentVersion}/${product.id}` | ||
: product.href | ||
}` | ||
|
||
return ( | ||
<li | ||
key={product.id} | ||
title={`${product.name}${product.external ? '(External Site)' : ''}`} | ||
className="my-3" | ||
> | ||
<Link | ||
href={href} | ||
target={product.external ? '_blank' : undefined} | ||
className="f4 pl-4 pr-5 py-2 color-text-primary no-underline" | ||
> | ||
{product.name} | ||
{product.external && ( | ||
<span className="ml-1"> | ||
<LinkExternalIcon size="small" /> | ||
</span> | ||
)} | ||
</Link> | ||
</li> | ||
) | ||
})} | ||
</ul> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useRouter } from 'next/router' | ||
import { MarkGithubIcon } from '@primer/octicons-react' | ||
|
||
import { Link } from 'components/Link' | ||
import { useTranslation } from 'components/hooks/useTranslation' | ||
import { useMainContext } from 'components/context/MainContext' | ||
import { SidebarProduct } from './SidebarProduct' | ||
import { SidebarHomepage } from './SidebarHomepage' | ||
|
||
export const SidebarNav = () => { | ||
const router = useRouter() | ||
const { error, relativePath } = useMainContext() | ||
const { t } = useTranslation('header') | ||
|
||
return ( | ||
<div | ||
className="d-none d-lg-block color-bg-tertiary position-sticky top-0 overflow-y-auto flex-shrink-0 pb-5" | ||
style={{ width: 286, height: '100vh' }} | ||
> | ||
<div | ||
className="d-flex flex-items-center p-4 position-sticky top-0 color-bg-tertiary" | ||
style={{ zIndex: 3 }} | ||
id="github-logo" | ||
role="banner" | ||
> | ||
<Link | ||
href={`/${router.locale}`} | ||
className="color-text-primary" | ||
aria-hidden="true" | ||
tabIndex={-1} | ||
> | ||
<MarkGithubIcon size={32} /> | ||
</Link> | ||
<Link | ||
href={`/${router.locale}`} | ||
className="h4-mktg color-text-primary no-underline no-wrap pl-2 flex-auto" | ||
> | ||
{t('github_docs')} | ||
</Link> | ||
</div> | ||
<nav> | ||
{error === '404' || relativePath === 'index.md' ? <SidebarHomepage /> : <SidebarProduct />} | ||
</nav> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.sidebarArticle::before { | ||
content: ""; | ||
position: absolute; | ||
left: 26px; | ||
height: 100%; | ||
border-left: 1px solid var(--color-text-primary); | ||
width: 1px; | ||
top: 0; | ||
} | ||
|
||
.sidebarArticleActive::before { | ||
border-left-width: 2px; | ||
} |
Oops, something went wrong.