-
Notifications
You must be signed in to change notification settings - Fork 350
Nextra 4 Migration 3: layouts and fixes #8118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hasparus
wants to merge
22
commits into
rebranding-2-nextra-4-filemoves
Choose a base branch
from
rebranding-3-nextra-4-fixes
base: rebranding-2-nextra-4-filemoves
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7efdeba
Add pagefind, use --turbopack flag in dev script
hasparus 0d79264
Let Next update tsconfig.json and next-env.d.ts
hasparus 9087dfe
Update tsconfig.json to use moduleResolution=bundler
hasparus d6a7bb4
Create HiveLayout server component to use in Layouts
hasparus d9c79e4
Refactor hive-outer-layout out
hasparus cc98c81
Rename file to hive-inner-layout
hasparus aa9e4f6
Create layouts for landing and content pages
hasparus cba23ed
Move example page to .tsx
hasparus 711b593
Remove _app.tsx
hasparus 6ca8791
Rename /index.mdx to /page.tsx
hasparus 6d477f8
Add fonts
hasparus a364215
Fix server components warning in examples page
hasparus c5e22a9
Set typedRoutes and treeshaking to true
hasparus 17fb387
Add MDX page templates
hasparus 32fd8a6
Add missing metadata to fix RSC error
hasparus 978d47d
Make the pages render without errors
hasparus efba5ba
Include LegacyDocsBanner
hasparus eed8c13
Fix Hero leading
hasparus cd4e931
Checkout a better yarn.lock
hasparus 7891c42
Remove unused theme.config.tsx
hasparus 758429c
Update website/src/components/docs-mdx-components.tsx
hasparus 8b132f0
Fix next.config.js
hasparus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useMDXComponents as getDocsMDXComponents } from '@theguild/components/server'; | ||
import { docsMDXComponents } from './src/components/docs-mdx-components'; | ||
|
||
export const useMDXComponents = () => { | ||
return getDocsMDXComponents(docsMDXComponents); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
website/src/app/(content-pages)/docs/[[...mdxPath]]/legacy-docs-banner.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use client'; | ||
|
||
import { usePathname } from 'next/navigation'; | ||
import { Callout } from '@theguild/components'; | ||
import { Link } from '../../../../components/docs-mdx-components'; | ||
|
||
export function LegacyDocsBanner() { | ||
const pathname = usePathname(); | ||
if (pathname.startsWith('/v1')) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Callout type="warning"> | ||
This is the documentation for the <b>old</b> GraphQL Mesh version v0. We recommend upgrading | ||
to the latest GraphQL Mesh version v1. | ||
<br /> | ||
<Link | ||
href="/v1/migration-from-v0" | ||
className="[*:has(div>&)]:mb-8 gap-2 underline hover:no-underline" | ||
> | ||
Migrate to GraphQL Mesh v1 | ||
</Link> | ||
</Callout> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
website/src/app/(content-pages)/docs/[[...mdxPath]]/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { generateStaticParamsFor, importPage } from 'nextra/pages'; | ||
import { NextPageProps } from '@theguild/components'; | ||
import { useMDXComponents } from '../../../../../mdx-components.js'; | ||
import { ConfiguredGiscus } from '../../../../components/configured-giscus'; | ||
import { LegacyDocsBanner } from './legacy-docs-banner'; | ||
|
||
/** | ||
* You might have an urge to try to refactor this to a separate file and reuse between product-updates and docs. | ||
* I had the same urge. It's absurdly finicky. I warned you. | ||
* | ||
* BTW, even if we moved the product updates to page.mdx pattern, we still need this nesting to fix links in sidebar. | ||
*/ | ||
export const generateStaticParams = async () => { | ||
const pages = await generateStaticParamsFor('mdxPath')(); | ||
return pages | ||
.map(page => (page.mdxPath[0] === 'docs' ? { mdxPath: page.mdxPath.slice(1) } : null)) | ||
.filter(Boolean); | ||
}; | ||
|
||
export async function generateMetadata(props: NextPageProps<'...mdxPath'>) { | ||
const params = await props.params; | ||
const { metadata } = await importPage(['docs', ...(params.mdxPath || [])]); | ||
return metadata; | ||
} | ||
|
||
const Wrapper = useMDXComponents().wrapper; | ||
|
||
export default async function Page(props: NextPageProps<'...mdxPath'>) { | ||
const params = await props.params; | ||
|
||
const result = await importPage(['docs', ...(params.mdxPath || [])]); | ||
const { default: MDXContent, toc, metadata } = result; | ||
|
||
return ( | ||
<Wrapper toc={toc} metadata={metadata}> | ||
<LegacyDocsBanner /> | ||
<MDXContent params={params} /> | ||
<ConfiguredGiscus /> | ||
</Wrapper> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { LiveDemo } from './live-demo'; | ||
|
||
export const metadata = { | ||
title: 'Examples', | ||
description: 'Examples of Mesh usage', | ||
}; | ||
|
||
export default function ExamplesPage() { | ||
return <LiveDemo />; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { HiveInnerLayout } from '../../components/hive-layout/hive-inner-layout'; | ||
import '@theguild/components/style.css'; | ||
|
||
export default function RootLayout({ children }: { children: React.ReactNode }) { | ||
return <HiveInnerLayout isLanding={false}>{children}</HiveInnerLayout>; | ||
} |
40 changes: 40 additions & 0 deletions
40
website/src/app/(content-pages)/v1/[[...mdxPath]]/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { generateStaticParamsFor, importPage } from 'nextra/pages'; | ||
import { NextPageProps } from '@theguild/components'; | ||
import { useMDXComponents } from '../../../../../mdx-components.js'; | ||
import { ConfiguredGiscus } from '../../../../components/configured-giscus'; | ||
|
||
/** | ||
* You might have an urge to try to refactor this to a separate file and reuse between product-updates and docs. | ||
* I had the same urge. It's absurdly finicky. I warned you. | ||
* | ||
* BTW, even if we moved the product updates to page.mdx pattern, we still need this nesting to fix links in sidebar. | ||
*/ | ||
export const generateStaticParams = async () => { | ||
const pages = await generateStaticParamsFor('mdxPath')(); | ||
return pages | ||
.map(page => (page.mdxPath[0] === 'docs' ? { mdxPath: page.mdxPath.slice(1) } : null)) | ||
.filter(Boolean); | ||
}; | ||
|
||
export async function generateMetadata(props: NextPageProps<'...mdxPath'>) { | ||
const params = await props.params; | ||
const { metadata } = await importPage(['docs', ...(params.mdxPath || [])]); | ||
return metadata; | ||
} | ||
|
||
const Wrapper = useMDXComponents().wrapper; | ||
|
||
export default async function Page(props: NextPageProps<'...mdxPath'>) { | ||
const params = await props.params; | ||
|
||
const result = await importPage(['docs', ...(params.mdxPath || [])]); | ||
const { default: MDXContent, toc, metadata } = result; | ||
|
||
return ( | ||
<Wrapper toc={toc} metadata={metadata}> | ||
<MDXContent params={params} /> | ||
<ConfiguredGiscus /> | ||
</Wrapper> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { HiveInnerLayout } from '../../components/hive-layout/hive-inner-layout'; | ||
import '@theguild/components/style.css'; | ||
|
||
export default function RootLayout({ children }: { children: React.ReactNode }) { | ||
return <HiveInnerLayout isLanding>{children}</HiveInnerLayout>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const metadata = { | ||
title: 'GraphQL Mesh', | ||
description: 'A fully-featured GraphQL gateway framework', | ||
}; | ||
|
||
export { IndexPage as default } from '../../components/index-page'; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.