Add custom MDXProvider to /docs pages

This commit is contained in:
Kevin Pruett 2020-06-19 13:56:01 -04:00
parent d04ab67045
commit 86e8a2044b
No known key found for this signature in database
GPG Key ID: 7E24696E93F2D9A0
5 changed files with 1521 additions and 421 deletions

4
website/.stylelintrc.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
...require('@hashicorp/nextjs-scripts/.stylelintrc.js'),
/* Specify overrides here */
}

View File

@ -1,17 +1,20 @@
import DocsPage from '@hashicorp/react-docs-page'
import order from '../data/docs-navigation.js'
import { frontMatter } from '../pages/docs/**/*.mdx'
import { MDXProvider } from '@mdx-js/react'
import Placement from '../components/placement-table'
import Head from 'next/head'
import Link from 'next/link'
import DocsPage from '@hashicorp/react-docs-page'
import { createMdxProvider } from '@hashicorp/nextjs-scripts/lib/providers/docs'
import order from '../data/docs-navigation.js'
import { frontMatter } from '../pages/docs/**/*.mdx'
import Placement from '../components/placement-table'
const DEFAULT_COMPONENTS = { Placement }
const MDXProvider = createMdxProvider({
product: 'nomad',
additionalComponents: [Placement],
})
function DocsLayoutWrapper(pageMeta) {
function DocsLayout(props) {
return (
<MDXProvider components={DEFAULT_COMPONENTS}>
<MDXProvider>
<DocsPage
{...props}
product="nomad"
@ -19,14 +22,14 @@ function DocsLayoutWrapper(pageMeta) {
is: Head,
title: `${pageMeta.page_title} | Nomad by HashiCorp`,
description: pageMeta.description,
siteName: 'Nomad by HashiCorp'
siteName: 'Nomad by HashiCorp',
}}
sidenav={{
Link,
category: 'docs',
currentPage: props.path,
data: frontMatter,
order
order,
}}
resourceURL={`https://github.com/hashicorp/nomad/blob/master/website/pages/${pageMeta.__resourcePath}`}
/>

1868
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
"version": "0.0.1",
"author": "HashiCorp",
"dependencies": {
"@hashicorp/nextjs-scripts": "^7.1.2",
"@hashicorp/nextjs-scripts": "^10.0.2",
"@hashicorp/react-alert-banner": "^3.1.0",
"@hashicorp/react-button": "^2.2.0",
"@hashicorp/react-call-to-action": "^0.2.0",

View File

@ -12,28 +12,29 @@
}
/* Global Transpiled Components */
@import '~@hashicorp/react-mega-nav/style.css';
@import '~@hashicorp/react-text-input/dist/style.css';
@import '~@hashicorp/react-alert/dist/style.css';
@import '~@hashicorp/react-button/dist/style.css';
@import '~@hashicorp/react-use-cases/dist/style.css';
@import '~@hashicorp/react-consent-manager/dist/style.css';
@import '~@hashicorp/react-hero/dist/style.css';
@import '~@hashicorp/react-section-header/dist/style.css';
@import '~@hashicorp/react-logo-grid/dist/style.css';
@import '~@hashicorp/react-product-downloader/dist/style.css';
@import '~@hashicorp/react-vertical-text-block-list/dist/style.css';
@import '~@hashicorp/react-docs-sidenav/dist/style.css';
@import '~@hashicorp/react-content/dist/style.css';
@import '~@hashicorp/react-subnav/dist/style.css';
@import '~@hashicorp/react-text-and-content/dist/style.css';
@import '~@hashicorp/react-call-to-action/dist/style.css';
@import '~@hashicorp/react-code-block/dist/style.css';
@import '~@hashicorp/react-consent-manager/dist/style.css';
@import '~@hashicorp/react-toggle/dist/style.css';
@import '~@hashicorp/react-alert/dist/style.css';
@import '~@hashicorp/react-call-to-action/dist/style.css';
@import '~@hashicorp/react-text-split/dist/style.css';
@import '~@hashicorp/react-text-split-with-code/dist/style.css';
@import '~@hashicorp/react-content/dist/style.css';
@import '~@hashicorp/react-docs-page/dist/style.css';
@import '~@hashicorp/react-docs-sidenav/dist/style.css';
@import '~@hashicorp/react-enterprise-alert/dist/style.css';
@import '~@hashicorp/react-hero/dist/style.css';
@import '~@hashicorp/react-logo-grid/dist/style.css';
@import '~@hashicorp/react-mega-nav/style.css';
@import '~@hashicorp/react-product-downloader/dist/style.css';
@import '~@hashicorp/react-section-header/dist/style.css';
@import '~@hashicorp/react-subnav/dist/style.css';
@import '~@hashicorp/react-tabs/dist/style.css';
@import '~@hashicorp/react-text-and-content/dist/style.css';
@import '~@hashicorp/react-text-input/dist/style.css';
@import '~@hashicorp/react-text-split-with-code/dist/style.css';
@import '~@hashicorp/react-text-split/dist/style.css';
@import '~@hashicorp/react-toggle/dist/style.css';
@import '~@hashicorp/react-use-cases/dist/style.css';
@import '~@hashicorp/react-vertical-text-block-list/dist/style.css';
/* Local Components */
@import '../components/placement-table/style.css';
@ -71,17 +72,17 @@
.g-section-block section {
padding-top: 96px;
padding-bottom: 96px;
}
.g-section-block section > .g-section-header + *,
.g-section-block section > .g-container > .g-section-header + * {
& > .g-section-header + *,
& > .g-container > .g-section-header + * {
margin-top: 72px;
}
.g-section-block section > * + *,
.g-section-block section > .g-container > * + * {
& > * + *,
& > .g-container > * + * {
margin-top: 96px;
}
}
.g-section-block .button-container {
display: -webkit-box;