Skip to content

Commit

Permalink
updating secondary nav for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
donjo committed Jun 6, 2024
1 parent 2a0fac5 commit e69815e
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 17 deletions.
8 changes: 6 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ const config = {
activeBaseRegex: `^/examples`,
},
{
to: "/api",
to: "/api/deno",
label: "API Reference",
position: "left",
id: "toggleSecondaryNav",
items: [
{ to: "/api/deno", label: "Deno" },
{ to: "/api/web", label: "Web" },
{ to: "/api/node", label: "Node" },
],
},
{
href: "https://www.deno.com",
Expand Down
4 changes: 2 additions & 2 deletions src/components/APIReferenceIndex/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ const APIReferenceIndex: React.FC<APIReferenceIndexProps> = ({ apiLinks }) => {
<ul>
{apiLinks.map((link) => {
return (
<li key={link.id}>
<li className="list-none" key={link.id}>
<a
href={link.url}
className="text-inherit underline decoration-gray-300 dark:decoration-gray-600"
title={link.description}
>
{link.title}
</a>
<p className="text-gray-500 dark:text-gray-400">
<p className="text-gray-500 dark:text-gray-0">
{link.description}
</p>
</li>
Expand Down
27 changes: 22 additions & 5 deletions src/components/SecondaryNavbar.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
import React from "react";
import NavbarNavLink from "@theme/NavbarItem/NavbarNavLink";

function SecondaryNavbar() {
return (
<div className="secondary-navbar w-full">
<div className="secondary-navbar-content">
{/* Your nav items here */}

<a className="navbar__item navbar__link" href="/api/deno">Deno</a>
<a className="navbar__item navbar__link" href="/api/web">Web</a>
<a className="navbar__item navbar__link" href="/api/node">Node</a>
<NavbarNavLink
activeClassName="navbar__link--active"
className="navbar__item navbar__link"
to="/api/deno"
position="left"
label="Deno"
/>
<NavbarNavLink
activeClassName="navbar__link--active"
className="navbar__item navbar__link"
to="/api/web"
position="left"
label="Web"
/>
<NavbarNavLink
activeClassName="navbar__link--active"
className="navbar__item navbar__link"
to="/api/node"
position="left"
label="Node"
/>
</div>
</div>
);
Expand Down
8 changes: 8 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ td p:last-child {
padding: 0 2px;
}

.navbar__secondary a {
display: inline-block;
}

.navbar__secondary a:first-child {
margin-left: 0;
}

.navbar__link {
margin-left: 10px;
margin-right: 10px;
Expand Down
8 changes: 0 additions & 8 deletions src/pages/api/index.jsx

This file was deleted.

95 changes: 95 additions & 0 deletions src/pages/api/node.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React from "react";
import APIReferenceIndex from "/../src/components/APIReferenceIndex";

const links = [
{
id: "1",
title: "FFI",
description:
"Foreign Function Interface. Call functions from shared libraries (e.g., C/C++) directly from Deno. Useful for integrating with existing native code or accessing low-level system functionality.",
url: "/api/deno/ffi",
},
{
id: "2",
title: "I/O",
description:
"Interfaces for reading, writing, seeking, and managing resources. For handling of data streams, file I/O, and console interactions.",
url: "/api/deno/io",
},
{
id: "3",
title: "Permissions",
description:
"Permission system controls access to resources (e.g., file system, network, environment variables). Request permissions explicitly, enhancing security and user trust.",
url: "/api/deno/permissions",
},
{
id: "4",
title: "Jupyter",
description:
"Create interactive notebooks and execute code cells. Useful for data analysis, visualization, and educational purposes.",
url: "/api/deno/jupyter",
},
{
id: "5",
title: "Cloud",
description:
"Tools for managing state, scheduling tasks, and interacting with key-value stores.",
url: "/api/deno/cloud",
},
{
id: "6",
title: "FS",
description:
"File System APIs for working with files, directories, and file metadata. Includes functions for reading, writing, and manipulating file paths.",
url: "/api/deno/fs",
},
{
id: "7",
title: "Network",
description:
"A wide range of networking tasks, from low-level connections to high-level server creation. Handle HTTP requests, WebSocket communication, and DNS resolution. Useful for building web servers, clients, and networking tools.",
url: "/api/deno/network",
},
{
id: "8",
title: "HTTP Server",
description:
"Handling HTTP requests, serving responses, and managing server behavior.",
url: "/api/deno/http-server",
},
{
id: "9",
title: "Sub Process",
description:
"Spawn and manage child processes, execute commands, and collect output. Useful for executing external programs from Deno.",
url: "/api/deno/sub-process",
},
{
id: "10",
title: "Errors",
description:
"Error types and utilities for handling exceptions and custom error scenarios. Helps improve error handling and debugging.",
url: "/api/deno/errors",
},
{
id: "11",
title: "Runtime Env",
description:
"System-related functionality, process management, and observability.",
url: "/api/deno/runtime-env",
},
{
id: "12",
title: "Testing & Benchmarking",
description:
"Robust testing and benchmarking capabilities to ensure code quality and performance.",
url: "/api/deno/testing-benchmarking",
},
];

const APIPage = () => {
return <APIReferenceIndex apiLinks={links} />;
};

export default APIPage;
95 changes: 95 additions & 0 deletions src/pages/api/web.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React from "react";
import APIReferenceIndex from "/../src/components/APIReferenceIndex";

const links = [
{
id: "1",
title: "FFI",
description:
"Foreign Function Interface. Call functions from shared libraries (e.g., C/C++) directly from Deno. Useful for integrating with existing native code or accessing low-level system functionality.",
url: "/api/deno/ffi",
},
{
id: "2",
title: "I/O",
description:
"Interfaces for reading, writing, seeking, and managing resources. For handling of data streams, file I/O, and console interactions.",
url: "/api/deno/io",
},
{
id: "3",
title: "Permissions",
description:
"Permission system controls access to resources (e.g., file system, network, environment variables). Request permissions explicitly, enhancing security and user trust.",
url: "/api/deno/permissions",
},
{
id: "4",
title: "Jupyter",
description:
"Create interactive notebooks and execute code cells. Useful for data analysis, visualization, and educational purposes.",
url: "/api/deno/jupyter",
},
{
id: "5",
title: "Cloud",
description:
"Tools for managing state, scheduling tasks, and interacting with key-value stores.",
url: "/api/deno/cloud",
},
{
id: "6",
title: "FS",
description:
"File System APIs for working with files, directories, and file metadata. Includes functions for reading, writing, and manipulating file paths.",
url: "/api/deno/fs",
},
{
id: "7",
title: "Network",
description:
"A wide range of networking tasks, from low-level connections to high-level server creation. Handle HTTP requests, WebSocket communication, and DNS resolution. Useful for building web servers, clients, and networking tools.",
url: "/api/deno/network",
},
{
id: "8",
title: "HTTP Server",
description:
"Handling HTTP requests, serving responses, and managing server behavior.",
url: "/api/deno/http-server",
},
{
id: "9",
title: "Sub Process",
description:
"Spawn and manage child processes, execute commands, and collect output. Useful for executing external programs from Deno.",
url: "/api/deno/sub-process",
},
{
id: "10",
title: "Errors",
description:
"Error types and utilities for handling exceptions and custom error scenarios. Helps improve error handling and debugging.",
url: "/api/deno/errors",
},
{
id: "11",
title: "Runtime Env",
description:
"System-related functionality, process management, and observability.",
url: "/api/deno/runtime-env",
},
{
id: "12",
title: "Testing & Benchmarking",
description:
"Robust testing and benchmarking capabilities to ensure code quality and performance.",
url: "/api/deno/testing-benchmarking",
},
];

const APIPage = () => {
return <APIReferenceIndex apiLinks={links} />;
};

export default APIPage;

0 comments on commit e69815e

Please sign in to comment.