|
1 |
| -import { PropsWithChildren, createContext, Context, useMemo, useCallback } from 'react' |
2 |
| -import Head from 'next/head' |
| 1 | +import { PropsWithChildren, useMemo, useCallback } from 'react' |
| 2 | +import { NextSeo } from 'next-seo' |
3 | 3 | import { MDXProvider } from '@mdx-js/react'
|
4 | 4 | import { ThemeUIStyleObject } from 'theme-ui'
|
5 | 5 | import { NewGDSDivider, NewGDSDividerProps, Spacing, Flex } from '@edgeandnode/components'
|
6 | 6 | import { useSet } from 'react-use'
|
7 | 7 |
|
8 |
| -import { NavItem, NavItemPage } from '@/navigation' |
9 |
| -import { MDXLayoutNav, MDXLayoutPagination, MDXLayoutOutline } from '@/layout' |
| 8 | +import { |
| 9 | + NavContext, |
| 10 | + NavContextProps, |
| 11 | + DocumentContext, |
| 12 | + DocumentContextProps, |
| 13 | + MDXLayoutNav, |
| 14 | + MDXLayoutPagination, |
| 15 | + MDXLayoutOutline, |
| 16 | +} from '@/layout' |
10 | 17 | import {
|
11 | 18 | Blockquote,
|
12 | 19 | CodeBlock,
|
@@ -60,36 +67,6 @@ const mdxStyles = {
|
60 | 67 | },
|
61 | 68 | } as ThemeUIStyleObject
|
62 | 69 |
|
63 |
| -export type NavContextProps = { |
64 |
| - pagePath: string |
65 |
| - navItems: NavItem[] |
66 |
| - pageNavItems: NavItemPage[] |
67 |
| - previousPage: NavItemPage | null |
68 |
| - currentPage: NavItemPage | null |
69 |
| - nextPage: NavItemPage | null |
70 |
| -} |
71 |
| - |
72 |
| -export const NavContext = createContext(null) as Context<NavContextProps | null> |
73 |
| - |
74 |
| -export type Frontmatter = { |
75 |
| - title?: string |
76 |
| -} |
77 |
| - |
78 |
| -export type OutlineItem = { |
79 |
| - id: string |
80 |
| - title: string |
81 |
| - level: 1 | 2 | 3 | 4 | 5 | 6 |
82 |
| -} |
83 |
| - |
84 |
| -export type DocumentContextProps = { |
85 |
| - frontmatter?: Frontmatter |
86 |
| - outline: OutlineItem[] |
87 |
| - markOutlineItem: (id: string, inOrAboveView: boolean) => void |
88 |
| - highlightedOutlineItemId: string | null |
89 |
| -} |
90 |
| - |
91 |
| -export const DocumentContext = createContext(null) as Context<DocumentContextProps | null> |
92 |
| - |
93 | 70 | export type MDXLayoutProps = PropsWithChildren<
|
94 | 71 | Pick<NavContextProps, 'pagePath' | 'navItems'> & Pick<DocumentContextProps, 'frontmatter' | 'outline'>
|
95 | 72 | >
|
@@ -154,9 +131,7 @@ export const MDXLayout = ({ pagePath, navItems, frontmatter, outline, children }
|
154 | 131 | return (
|
155 | 132 | <NavContext.Provider value={{ pagePath, navItems, pageNavItems, previousPage, currentPage, nextPage }}>
|
156 | 133 | <DocumentContext.Provider value={{ frontmatter, outline, markOutlineItem, highlightedOutlineItemId }}>
|
157 |
| - <Head> |
158 |
| - <title>{frontmatter?.title ? `${frontmatter.title} - ` : ''}The Graph Docs</title> |
159 |
| - </Head> |
| 134 | + <NextSeo title={`${frontmatter?.title ? `${frontmatter.title} - ` : ''} The Graph Docs`} /> |
160 | 135 |
|
161 | 136 | <div
|
162 | 137 | sx={{
|
|
0 commit comments