Implement layout

This commit is contained in:
Marcus Blättermann 2022-11-14 01:44:12 +01:00
parent 6de49b9f1a
commit d3f95831aa
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D
3 changed files with 5 additions and 18 deletions

View File

@ -1,9 +0,0 @@
const Layout = (args) => {
return (
<>
<div>{args.children}</div>
</>
)
}
export default Layout

View File

@ -3,7 +3,7 @@ import { serialize } from 'next-mdx-remote/serialize'
import fs from 'fs' import fs from 'fs'
import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote' import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote'
import path from 'path' import path from 'path'
import Layout from '../components/layout' import Layout from '../src/templates'
import remarkPlugins from '../plugins/index.mjs' import remarkPlugins from '../plugins/index.mjs'
import recordSection from '../meta/recordSections' import recordSection from '../meta/recordSections'

View File

@ -95,8 +95,8 @@ class Layout extends React.Component {
} }
render() { render() {
const { pageContext, location, children } = this.props const { location, children } = this.props
const { title, section, sectionTitle, teaser, theme = 'blue', searchExclude } = pageContext const { title, section, sectionTitle, teaser, theme = 'blue', searchExclude } = this.props
const uiTheme = nightly ? 'nightly' : legacy ? 'legacy' : theme const uiTheme = nightly ? 'nightly' : legacy ? 'legacy' : theme
const bodyClass = classNames(`theme-${uiTheme}`, { 'search-exclude': !!searchExclude }) const bodyClass = classNames(`theme-${uiTheme}`, { 'search-exclude': !!searchExclude })
const isDocs = ['usage', 'models', 'api', 'styleguide'].includes(section) const isDocs = ['usage', 'models', 'api', 'styleguide'].includes(section)
@ -122,13 +122,9 @@ class Layout extends React.Component {
<Progress /> <Progress />
</Navigation> </Navigation>
{isDocs ? ( {isDocs ? (
<Docs pageContext={pageContext}>{content}</Docs> <Docs pageContext={this.props}>{children}</Docs>
) : section === 'universe' ? ( ) : section === 'universe' ? (
<Universe <Universe pageContext={this.props} location={location} />
pageContext={pageContext}
location={location}
mdxComponents={mdxComponents}
/>
) : ( ) : (
<div> <div>
{children} {children}