Skip to content

Commit 2500832

Browse files
relocate index page, add "use client", refactor layout
1 parent f617321 commit 2500832

File tree

12 files changed

+47
-40
lines changed

12 files changed

+47
-40
lines changed

src/app/(main)/layout.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/app/(main)/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { Metadata } from "next"
2+
import { IndexPage } from "../../components/index-page"
3+
4+
export const metadata: Metadata = {
5+
title: "GraphQL | A query language for your API",
6+
}
7+
8+
export default function Page() {
9+
return <IndexPage />
10+
}

src/app/layout.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import { ReactElement, ReactNode } from "react"
22
import { Metadata } from "next"
33
import GoogleAnalytics from "@/app/ga"
44

5+
// @ts-expect-error: we want to import the same version as Nextra for the main page
6+
import { ThemeProvider } from "next-themes"
7+
8+
import { Footer } from "../components/footer"
9+
import { NewFontsStyleTag } from "./fonts"
10+
import { Navbar } from "../components/navbar/navbar"
11+
import { topLevelNavbarItems } from "../components/navbar/top-level-items"
12+
import { MenuProvider } from "./(main)/menu-provider"
13+
514
import "../globals.css"
615

716
export const metadata: Metadata = {
@@ -35,7 +44,16 @@ export default function RootLayout({
3544
</head>
3645
<body className="bg-neu-0">
3746
<GoogleAnalytics />
38-
{children}
47+
<NewFontsStyleTag />
48+
<ThemeProvider attribute="class">
49+
<MenuProvider>
50+
<Navbar items={topLevelNavbarItems} />
51+
<div className="isolate bg-neu-0 text-neu-900 antialiased">
52+
{children}
53+
</div>
54+
<Footer />
55+
</MenuProvider>
56+
</ThemeProvider>
3957
</body>
4058
</html>
4159
)

src/app/not-found.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { StripesDecoration } from "@/app/conf/_design-system/stripes-decoration"
77
import stripesMask from "@/components/404-page/image.webp"
88

99
import { Button } from "./conf/_design-system/button"
10-
import MainLayout from "./(main)/layout"
1110

1211
import "@/globals.css"
1312
import "@/app/colors.css"
@@ -31,7 +30,7 @@ export default function NotFoundPage() {
3130
}/issues/new?title=${encodeURIComponent(title)}&labels=${labels}`
3231

3332
return (
34-
<MainLayout>
33+
<>
3534
<style>{".nextra-nav-container.sticky { position: fixed }"}</style>
3635
<div className="relative">
3736
<Stripes />
@@ -48,7 +47,7 @@ export default function NotFoundPage() {
4847
</div>
4948
</div>
5049
</div>
51-
</MainLayout>
50+
</>
5251
)
5352
}
5453

src/components/index-page/data-colocation/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client"
2+
13
import * as React from "react"
24
import { clsx } from "clsx"
35
import { Code } from "nextra/components"

src/components/index-page/graphql-advantages/consistency.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client"
2+
13
import { useEffect, useRef } from "react"
24
import { Code } from "nextra/components"
35

src/components/index-page/graphql-advantages/precision.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client"
2+
13
import { ComponentPropsWithoutRef, useEffect, useRef } from "react"
24
import { Code } from "nextra/components"
35
import { clsx } from "clsx"

src/components/index-page/graphql-advantages/versionless.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client"
2+
13
import { useEffect, useRef } from "react"
24
import { Code } from "nextra/components"
35
import { clsx } from "clsx"

src/components/index-page/how-it-works/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client"
2+
13
import { useRef, useState } from "react"
24
import { useInView } from "motion/react"
35
import dynamic from "next/dynamic"

src/components/index-page/how-it-works/interactive-editor.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
"use client"
2+
13
import { graphql } from "graphql"
2-
import React, { useState } from "react"
4+
import { useRef, useState } from "react"
35

46
import { getVariableToType } from "@/components/interactive-code-block/get-variable-to-type"
57
import { QueryEditor } from "@/components/interactive-code-block/query-editor"
@@ -20,7 +22,7 @@ export default function InteractiveEditor() {
2022
const [results, setResults] = useState(INITIAL_RESULTS_TEXT)
2123
const [variableTypes, setVariableTypes] = useState<Record<string, string>>({})
2224
const [variables, setVariables] = useState("")
23-
const editorQueryId = React.useRef(0)
25+
const editorQueryId = useRef(0)
2426

2527
async function runQuery(
2628
options: { manual: boolean },

0 commit comments

Comments
 (0)