Skip to content

Commit fa14e30

Browse files
authored
Merge pull request #3073 from pyth-network/feat/dev-hub-positioning
fix(dev-hub): sidebar and table of contents positioning
2 parents b5b190d + 6610d9f commit fa14e30

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

apps/developer-hub/src/components/Root/fumadocs-global-style-overrides.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,24 @@ Overrides for Fumadocs content. Everything after prose is MDX generated content
2626

2727
#nd-sidebar {
2828
--fd-sidebar-top: var(--header-height) !important;
29+
position: sticky !important;
30+
height: calc(100vh - var(--header-height));
31+
}
32+
33+
#nd-docs-layout {
34+
flex-direction: row !important;
35+
padding-inline-start: 0 !important;
36+
}
37+
38+
/* Hacky fix to get the TOC to be sticky */
39+
#nd-toc {
40+
top: var(--header-height) !important;
41+
height: max-content;
42+
position: sticky;
43+
margin-left: calc(-1 * var(--fd-toc-width));
44+
}
45+
46+
#nd-toc > div {
47+
position: relative;
48+
left: var(--fd-toc-width);
2949
}

apps/developer-hub/src/components/search-button.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { SearchButton as SearchButtonComponent } from "@pythnetwork/component-library/SearchButton";
44
import DefaultSearchDialog from "fumadocs-ui/components/dialog/search-default";
55
import { useCallback, useState } from "react";
6+
import { createPortal } from "react-dom";
67

78
export const SearchButton = () => {
89
const [open, setOpen] = useState(false);
@@ -19,11 +20,15 @@ export const SearchButton = () => {
1920
largeScreenContent="Search"
2021
onClick={handleSearch}
2122
/>
22-
<DefaultSearchDialog
23-
open={open}
24-
onOpenChange={setOpen}
25-
api="/api/search"
26-
/>
23+
{open &&
24+
createPortal(
25+
<DefaultSearchDialog
26+
open={open}
27+
onOpenChange={setOpen}
28+
api="/api/search"
29+
/>,
30+
document.body,
31+
)}
2732
</>
2833
);
2934
};

packages/component-library/src/AppShell/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
background: theme.color("background", "primary");
3434
border-top-left-radius: calc(var(--offset) * theme.border-radius("xl"));
3535
border-top-right-radius: calc(var(--offset) * theme.border-radius("xl"));
36+
height: 100dvh;
3637
overflow: hidden auto;
3738
transform: scale(calc(100% - (var(--offset) * 5%)));
38-
height: 100dvh;
3939
scrollbar-gutter: stable;
4040

4141
.header {

0 commit comments

Comments
 (0)