github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/_app.js (about)

     1  import './style.css'
     2  import '@hashicorp/nextjs-scripts/lib/nprogress/style.css'
     3  
     4  import Router from 'next/router'
     5  import Head from 'next/head'
     6  import NProgress from '@hashicorp/nextjs-scripts/lib/nprogress'
     7  import { ErrorBoundary } from '@hashicorp/nextjs-scripts/lib/bugsnag'
     8  import createConsentManager from '@hashicorp/nextjs-scripts/lib/consent-manager'
     9  import useAnchorLinkAnalytics from '@hashicorp/nextjs-scripts/lib/anchor-link-analytics'
    10  import MegaNav from '@hashicorp/react-mega-nav'
    11  import AlertBanner from '@hashicorp/react-alert-banner'
    12  import HashiHead from '@hashicorp/react-head'
    13  import Footer from '../components/footer'
    14  import ProductSubnav from '../components/subnav'
    15  import Error from './_error'
    16  import alertBannerData, { ALERT_BANNER_ACTIVE } from '../data/alert-banner'
    17  
    18  NProgress({ Router })
    19  const { ConsentManager, openConsentManager } = createConsentManager({
    20    preset: 'oss',
    21  })
    22  
    23  function App({ Component, pageProps }) {
    24    useAnchorLinkAnalytics()
    25  
    26    return (
    27      <ErrorBoundary FallbackComponent={Error}>
    28        <HashiHead
    29          is={Head}
    30          title="Nomad by HashiCorp"
    31          siteName="Nomad by HashiCorp"
    32          description="Nomad is a highly available, distributed, data-center aware cluster and application scheduler designed to support the modern datacenter with support for long-running services, batch jobs, and much more."
    33          image="https://www.nomadproject.io/img/og-image.png"
    34          stylesheet={[
    35            {
    36              href:
    37                'https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&display=swap',
    38            },
    39          ]}
    40          icon={[{ href: '/favicon.ico' }]}
    41          preload={[
    42            { href: '/fonts/klavika/medium.woff2', as: 'font' },
    43            { href: '/fonts/gilmer/light.woff2', as: 'font' },
    44            { href: '/fonts/gilmer/regular.woff2', as: 'font' },
    45            { href: '/fonts/gilmer/medium.woff2', as: 'font' },
    46            { href: '/fonts/gilmer/bold.woff2', as: 'font' },
    47            { href: '/fonts/metro-sans/book.woff2', as: 'font' },
    48            { href: '/fonts/metro-sans/regular.woff2', as: 'font' },
    49            { href: '/fonts/metro-sans/semi-bold.woff2', as: 'font' },
    50            { href: '/fonts/metro-sans/bold.woff2', as: 'font' },
    51            { href: '/fonts/dejavu/mono.woff2', as: 'font' },
    52          ]}
    53        />
    54        {ALERT_BANNER_ACTIVE && (
    55          <AlertBanner {...alertBannerData} theme="nomad" />
    56        )}
    57        <MegaNav product="Nomad" />
    58        <ProductSubnav />
    59        <div className={`content${ALERT_BANNER_ACTIVE ? ' banner' : ''}`}>
    60          <Component {...pageProps} />
    61        </div>
    62        <Footer openConsentManager={openConsentManager} />
    63        <ConsentManager />
    64      </ErrorBoundary>
    65    )
    66  }
    67  
    68  App.getInitialProps = async ({ Component, ctx }) => {
    69    let pageProps = {}
    70  
    71    if (Component.getInitialProps) {
    72      pageProps = await Component.getInitialProps(ctx)
    73    } else if (Component.isMDXComponent) {
    74      // fix for https://github.com/mdx-js/mdx/issues/382
    75      const mdxLayoutComponent = Component({}).props.originalType
    76      if (mdxLayoutComponent.getInitialProps) {
    77        pageProps = await mdxLayoutComponent.getInitialProps(ctx)
    78      }
    79    }
    80  
    81    return { pageProps }
    82  }
    83  
    84  export default App