diff --git a/src/app/components/navbar.tsx b/src/app/components/navbar.tsx
index 21e3219..b996a8f 100644
--- a/src/app/components/navbar.tsx
+++ b/src/app/components/navbar.tsx
@@ -8,6 +8,7 @@ import Logo from "./logo";
import { ToggleThemeButton } from "./theme-toggle-button";
import { GithubStar } from "@/app/components/github-star";
import { Card } from "@/app/components/card";
+import { cn } from "@/common/utils";
type Page = {
/**
@@ -20,6 +21,11 @@ type Page = {
*/
url: string;
+ /**
+ * Whether to hide the button on mobile.
+ */
+ hideOnMobile?: boolean;
+
/**
* Whether clicking the button will
* open the link in a new tab.
@@ -31,7 +37,7 @@ const pages: Page[] = [
{ name: "Player", url: "/player" },
{ name: "Server", url: "/server/java" },
{ name: "Mojang", url: "/mojang/status" },
- { name: "API", url: "https://api.mcutils.xyz", openInNewTab: true },
+ { name: "API", url: "https://api.mcutils.xyz", hideOnMobile: true, openInNewTab: true },
{ name: "Docs", url: "/documentation" },
];
@@ -47,7 +53,7 @@ export default function NavBar(): ReactElement {
-
Minecraft Utilities
+
Minecraft Utilities
@@ -59,7 +65,7 @@ export default function NavBar(): ReactElement {
return (
{
+ const { metadata, content } = parseFrontmatter(getDocumentationFileContent(file));
+ let slug = path.basename(file, path.extname(file));
+
+ return {
+ metadata,
+ content,
+ slug,
+ };
+ });
+}
+
+/**
+ * Parses the frontmatter of a file.
+ *
+ * @param fileContent the content of the file.
+ */
function parseFrontmatter(fileContent: string) {
let frontmatterRegex = /---\s*([\s\S]*?)\s*---/;
let match = frontmatterRegex.exec(fileContent);
@@ -22,31 +69,3 @@ function parseFrontmatter(fileContent: string) {
return { metadata: metadata as Metadata, content };
}
-
-const documentationDirectory = path.join(process.cwd(), "documentation");
-
-/**
- * Gets the files for the documentation.
- */
-function getDocumentationFiles() {
- return fs.readdirSync(documentationDirectory);
-}
-
-function getDocumentationFileContent(file: string) {
- return fs.readFileSync(path.join(documentationDirectory, file), "utf-8");
-}
-
-export function getDocumentation() {
- const files = getDocumentationFiles();
-
- return files.map(file => {
- const { metadata, content } = parseFrontmatter(getDocumentationFileContent(file));
- let slug = path.basename(file, path.extname(file));
-
- return {
- metadata,
- content,
- slug,
- };
- });
-}