Skip to content

Commit 30b083d

Browse files
committed
chore(dev-hub)-header Improvements
1 parent 8e8172d commit 30b083d

File tree

3 files changed

+55
-18
lines changed

3 files changed

+55
-18
lines changed

apps/developer-hub/src/components/Root/index.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { AppShell } from "@pythnetwork/component-library/AppShell";
22
import { RootProvider as FumadocsRootProvider } from "fumadocs-ui/provider";
33
import { NuqsAdapter } from "nuqs/adapters/next/app";
44
import type { ReactNode } from "react";
5-
import "./global.css";
65

76
import {
87
AMPLITUDE_API_KEY,
98
ENABLE_ACCESSIBILITY_REPORTING,
109
GOOGLE_ANALYTICS_ID,
1110
} from "../../config/server";
11+
import { SearchButton } from "../search-button";
12+
13+
import "./global.css";
1214

1315
export const TABS = [
1416
{ segment: "", children: "Home" },
@@ -28,9 +30,23 @@ export const Root = ({ children }: Props) => (
2830
amplitudeApiKey={AMPLITUDE_API_KEY}
2931
googleAnalyticsId={GOOGLE_ANALYTICS_ID}
3032
enableAccessibilityReporting={ENABLE_ACCESSIBILITY_REPORTING}
33+
extraCta={<SearchButton />}
34+
mainCta={{
35+
label: "Insights",
36+
href: "https://insights.pyth.network/",
37+
}}
3138
providers={[NuqsAdapter]}
3239
tabs={TABS}
3340
>
34-
<FumadocsRootProvider>{children}</FumadocsRootProvider>
41+
<FumadocsRootProvider
42+
search={{
43+
enabled: true,
44+
options: {
45+
api: "/api/search",
46+
},
47+
}}
48+
>
49+
{children}
50+
</FumadocsRootProvider>
3551
</AppShell>
3652
);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"use client";
2+
3+
import DefaultSearchDialog from "fumadocs-ui/components/dialog/search-default";
4+
import { useState } from "react";
5+
6+
export const SearchButton = () => {
7+
const [open, setOpen] = useState(false);
8+
9+
return (
10+
<>
11+
<button
12+
onClick={() => {
13+
setOpen(true);
14+
}}
15+
style={{
16+
background: "transparent",
17+
border: "1px solid #ccc",
18+
padding: "8px 16px",
19+
borderRadius: "6px",
20+
cursor: "pointer",
21+
}}
22+
>
23+
Search
24+
</button>
25+
<DefaultSearchDialog
26+
open={open}
27+
onOpenChange={setOpen}
28+
api="/api/search"
29+
/>
30+
</>
31+
);
32+
};

apps/developer-hub/src/config/layout.config.tsx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import { source } from "../source";
55

66
export const baseOptions: BaseLayoutProps = {
77
nav: {
8-
enabled: false,
8+
enabled: true,
99
},
1010
themeSwitch: {
11+
enabled: true,
12+
},
13+
searchToggle: {
1114
enabled: false,
1215
},
1316
};
@@ -16,20 +19,6 @@ export const docsOptions: DocsLayoutProps = {
1619
...baseOptions,
1720
tree: source.pageTree,
1821
sidebar: {
19-
tabs: {
20-
transform(option, node) {
21-
const meta = source.getNodeMeta(node);
22-
if (!meta || !node.icon) return option;
23-
24-
return {
25-
...option,
26-
icon: (
27-
<div className="[&_svg]:size-6.5 md:[&_svg]:size-5">
28-
{node.icon}
29-
</div>
30-
),
31-
};
32-
},
33-
},
22+
tabs: false,
3423
},
3524
};

0 commit comments

Comments
 (0)