Skip to content

Commit

Permalink
update sidebar order
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjofrank committed Dec 11, 2024
1 parent 1e743aa commit ff0df6d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 29 deletions.
21 changes: 18 additions & 3 deletions _components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default function Sidebar(
(
<ul className="xl:hidden">
<SidebarTopNav name="Runtime" url="/runtime/" />
<SidebarTopNav name="Examples" url="/examples/" />
<SidebarTopNav name="API reference" url="/api/deno" />
<SidebarTopNav name="Examples" url="/examples/" />
<SidebarTopNav name="Deploy" url="/deploy/" />
<SidebarTopNav name="Subhosting" url="/subhosting/" />
</ul>
Expand All @@ -37,6 +37,7 @@ export default function Sidebar(
section={section}
search={props.search}
url={props.url}
headerPath={props.headerPath}
/>
))}
</ul>
Expand Down Expand Up @@ -156,7 +157,7 @@ function SidebarCategory(props: {
if (typeof item === "string") {
return item === props.url;
}
return item.id === props.url;
return typeof item === "object" && "id" in item && item.id === props.url;
});

return (
Expand Down Expand Up @@ -187,7 +188,21 @@ function SidebarCategory(props: {
data-accordion-content
>
{props.item.items.map((item) => (
<SidebarItem item={item} search={props.search} url={props.url} />
typeof item === "object" && "items" in item
? (
<SidebarCategory
item={item}
url={props.url}
search={props.search}
/>
)
: (
<SidebarItem
item={item}
search={props.search}
url={props.url}
/>
)
))}
</ul>
</>
Expand Down
27 changes: 1 addition & 26 deletions examples/index.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
import LandingPage from "./_pages/LandingPage.tsx";

export const layout = "raw.tsx";
export const sidebar = [
{
items: [
{
label: "Runtime",
id: "/runtime/",
},
{
label: "API Reference",
id: "/api/deno/",
},
{
label: "Examples",
id: "/examples/",
},
{
label: "Deploy",
id: "/deploy/",
},
{
label: "Subhosting",
id: "/subhosting/",
},
],
},
];
export const sidebar = [];

export const toc = [];

Expand Down

0 comments on commit ff0df6d

Please sign in to comment.