From 00a5febf663ee799828b37506af5355b93cf5667 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 22 Apr 2024 01:56:01 +0100 Subject: [PATCH] fix code highlighter colors and centre the breadcrumbs on docs --- documentation/server/server-lookup.md | 18 +++++---- src/app/(pages)/docs/[[...slug]]/page.tsx | 7 ++-- src/app/components/code-highlighter.tsx | 4 +- src/app/components/command-menu.tsx | 2 +- .../components/docs/documentation-pages.tsx | 40 ------------------- src/app/globals.css | 6 +-- 6 files changed, 21 insertions(+), 56 deletions(-) delete mode 100644 src/app/components/docs/documentation-pages.tsx diff --git a/documentation/server/server-lookup.md b/documentation/server/server-lookup.md index 4e49c85..fa87b08 100644 --- a/documentation/server/server-lookup.md +++ b/documentation/server/server-lookup.md @@ -38,17 +38,17 @@ curl -X GET "https://api.mcutils.xyz/server/java/play.hypixel.net" -H "accept: a ```json { "cache": { - "cached": false, - "cachedTime": -1 + "cached": true, + "cachedTime": 1713747259031 }, "hostname": "play.hypixel.net", - "ip": "209.222.115.48", + "ip": "209.222.115.34", "port": 25565, "records": [ { "type": "A", "ttl": 60, - "address": "209.222.115.48" + "address": "209.222.115.34" } ], "motd": { @@ -66,9 +66,13 @@ curl -X GET "https://api.mcutils.xyz/server/java/play.hypixel.net" -H "accept: a ] }, "players": { - "online": 33892, - "max": 200000, - "sample": [] + "online": 34943, + "max": 200000 + }, + "location": { + "country": "Canada", + "latitude": 43.6319, + "longitude": -79.3716 }, "version": { "name": "Requires MC 1.8 / 1.20", diff --git a/src/app/(pages)/docs/[[...slug]]/page.tsx b/src/app/(pages)/docs/[[...slug]]/page.tsx index 5d8e66b..b8deab8 100644 --- a/src/app/(pages)/docs/[[...slug]]/page.tsx +++ b/src/app/(pages)/docs/[[...slug]]/page.tsx @@ -61,8 +61,8 @@ export default function Page({ params: { slug } }: DocumentationPageParams) { const isHome: boolean = slugParts.length == 1; return ( -
-
+
+
{/* The breadcrumb for the documentation page */} @@ -88,6 +88,7 @@ export default function Page({ params: { slug } }: DocumentationPageParams) { + {/* The Git link for the documentation page */}
@@ -99,7 +100,7 @@ export default function Page({ params: { slug } }: DocumentationPageParams) {
{/* The content of the documentation page */} -
+
diff --git a/src/app/components/code-highlighter.tsx b/src/app/components/code-highlighter.tsx index b4f5c83..cd2e1ca 100644 --- a/src/app/components/code-highlighter.tsx +++ b/src/app/components/code-highlighter.tsx @@ -77,9 +77,9 @@ export function CodeHighlighter({ code, language = "json", rounded = true }: Cod renderer={rowRenderer} customStyle={{ maxHeight: "600px", - backgroundColor: "hsl(var(--background-accent))", + backgroundColor: "hsl(var(--secondary))", wordBreak: "break-all", - borderRadius: rounded ? "0.75rem" : undefined, + borderRadius: rounded ? "0.25rem" : undefined, }} > {code} diff --git a/src/app/components/command-menu.tsx b/src/app/components/command-menu.tsx index 71587db..db186df 100644 --- a/src/app/components/command-menu.tsx +++ b/src/app/components/command-menu.tsx @@ -89,7 +89,7 @@ export function CommandMenu({ ...props }: ButtonProps): ReactElement { /> No results found. - {pages && ( + {pages && pages.length > 1 && ( {pages.map(page => { return ( diff --git a/src/app/components/docs/documentation-pages.tsx b/src/app/components/docs/documentation-pages.tsx deleted file mode 100644 index 96603fa..0000000 --- a/src/app/components/docs/documentation-pages.tsx +++ /dev/null @@ -1,40 +0,0 @@ -"use client"; - -import { DocsContentMetadata } from "@/app/common/documentation"; -import React, { ReactElement } from "react"; -import { DialogClose } from "../ui/dialog"; -import { useRouter } from "next/navigation"; - -type PagesProps = { - /** - * The documentation pages to display. - */ - pages: DocsContentMetadata[] | undefined; -}; - -export function DocumentationPages({ pages }: PagesProps): ReactElement { - const router = useRouter(); - - return ( - <> - {pages && pages.length === 0 &&

No results found

} - - {pages && - pages.length > 1 && - pages.map(page => { - return ( - { - router.replace(`/docs/${page.slug}`); - }} - > -

{page.title}

-

{page.summary}

-
- ); - })} - - ); -} diff --git a/src/app/globals.css b/src/app/globals.css index 05edfe4..5189137 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -11,7 +11,7 @@ --card-foreground: 0 0% 3.9%; --popover: 0 0% 100%; --popover-foreground: 0 0% 3.9%; - --primary: 0 0% 9%; + --primary: 221.2 83.2% 53.3%; --primary-foreground: 0 0% 98%; --secondary: 0 0% 96.1%; --secondary-foreground: 0 0% 9%; @@ -34,9 +34,9 @@ --card-foreground: 0 0% 98%; --popover: 0 0% 3.9%; --popover-foreground: 0 0% 98%; - --primary: 0 0% 98%; + --primary: 217.2 91.2% 59.8%; --primary-foreground: 0 0% 9%; - --secondary: 0 0% 14.9%; + --secondary: 0 0% 9%; --secondary-foreground: 0 0% 98%; --muted: 0 0% 14.9%; --muted-foreground: 0 0% 63.9%;