1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/components/DefaultLayout.tsx
Mike Surowiec a511c95c7f SCSS and Component cleanup (pt 1) (#20572)
* turn article.scss into a module + componentized

* Update Survey to use only component styles, add cancel button

* Update GenericError + 404 page to use only standard classes

* update LearningTrack to not use markdown-body

* remove / consolidate stylesheets

* cleanup Graphiql explorer page and scss

* Componentize Breadcrumb styles

* Componentize DeprecationBanner styles

* scope h2 a link style to markdown-body

* cleanup nav, organize page-header and page-footer components

* remove unused scroll-button.scss

* organize LanguagePicker and ProductPicker

* add declarations file

* remove featured-links.scss, update tests

* update list utility and toc test

* fix bad merge resolution

* update breadcrumbs test
2021-07-29 17:27:20 +00:00

59 lines
1.9 KiB
TypeScript

import Head from 'next/head'
import { SidebarNav } from 'components/SidebarNav'
import { Header } from 'components/page-header/Header'
import { SmallFooter } from 'components/page-footer/SmallFooter'
import { ScrollButton } from 'components/ScrollButton'
import { SupportSection } from 'components/page-footer/SupportSection'
import { DeprecationBanner } from 'components/page-header/DeprecationBanner'
import { useMainContext } from 'components/context/MainContext'
import { useTranslation } from './hooks/useTranslation'
type Props = { children?: React.ReactNode }
export const DefaultLayout = (props: Props) => {
const { page, error, isHomepageVersion, currentPathWithoutLanguage } = useMainContext()
const { t } = useTranslation('errors')
return (
<div className="d-lg-flex">
<Head>
{error === '404' ? (
<title>{t('oops')}</title>
) : (!isHomepageVersion && page.fullTitle) ||
(currentPathWithoutLanguage.includes('enterprise-server') && page.fullTitle) ? (
<title>{page.fullTitle}</title>
) : null}
{/* For Google and Bots */}
{page.introPlainText && <meta name="description" content={page.introPlainText} />}
{page.topics.length > 0 && <meta name="keywords" content={page.topics.join(',')} />}
{page.hidden && <meta name="robots" content="noindex" />}
{page.languageVariants.map((languageVariant) => {
return (
<link
key={languageVariant.href}
rel="alternate"
hrefLang={languageVariant.hreflang}
href={`https://docs.github.com${languageVariant.href}`}
/>
)
})}
</Head>
<SidebarNav />
<main className="flex-1 min-width-0">
<Header />
<DeprecationBanner />
{props.children}
<SupportSection />
<SmallFooter />
<ScrollButton />
</main>
</div>
)
}