Skip to content

Commit 81400e9

Browse files
committed
Include LegacyDocsBanner
1 parent 8f3509e commit 81400e9

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
import Link from 'next/link';
2-
import { Anchor, Callout } from '@theguild/components';
1+
'use client';
2+
3+
import { usePathname } from 'next/navigation';
4+
import { Callout } from '@theguild/components';
5+
import { Link } from '../../../../components/docs-mdx-components';
36

47
export function LegacyDocsBanner() {
8+
const pathname = usePathname();
9+
if (pathname.startsWith('/v1')) {
10+
return null;
11+
}
12+
513
return (
614
<Callout type="warning">
715
This is the documentation for the <b>old</b> GraphQL Mesh version v0. We recommend upgrading
816
to the latest GraphQL Mesh version v1.
9-
<Anchor href="/v1/migration-from-v0" className="block">
17+
<br />
18+
<Link
19+
href="/v1/migration-from-v0"
20+
className="[*:has(div>&)]:mb-8 gap-2 underline hover:no-underline"
21+
>
1022
Migrate to GraphQL Mesh v1
11-
</Anchor>
23+
</Link>
1224
</Callout>
1325
);
1426
}

website/src/app/(content-pages)/docs/[[...mdxPath]]/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { generateStaticParamsFor, importPage } from 'nextra/pages';
33
import { NextPageProps } from '@theguild/components';
44
import { useMDXComponents } from '../../../../../mdx-components.js';
55
import { ConfiguredGiscus } from '../../../../components/configured-giscus';
6+
import { LegacyDocsBanner } from './legacy-docs-banner';
67

78
/**
89
* You might have an urge to try to refactor this to a separate file and reuse between product-updates and docs.
@@ -33,6 +34,7 @@ export default async function Page(props: NextPageProps<'...mdxPath'>) {
3334

3435
return (
3536
<Wrapper toc={toc} metadata={metadata}>
37+
<LegacyDocsBanner />
3638
<MDXContent params={params} />
3739
<ConfiguredGiscus />
3840
</Wrapper>

website/src/components/docs-mdx-components.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const Link: typeof Anchor = ({ className, ...props }) => {
1414
/>
1515
);
1616
};
17+
1718
export const docsMDXComponents = {
1819
a: Link,
1920
};

0 commit comments

Comments
 (0)