From ec27cd9f29a3f1fb1bf5fc2c2fdc5e07a0aa2acd Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 21 Apr 2024 17:39:00 +0100 Subject: [PATCH] add github icon and display breadcrumb on docs home page --- public/media/github.png | Bin 0 -> 5325 bytes src/app/(pages)/docs/[[...slug]]/page.tsx | 41 +++++++++++++--------- src/app/(pages)/docs/layout.tsx | 3 +- src/app/components/docs/github-link.tsx | 22 ++++++++++++ src/app/components/docs/sidebar.tsx | 10 ++++++ 5 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 public/media/github.png create mode 100644 src/app/components/docs/github-link.tsx create mode 100644 src/app/components/docs/sidebar.tsx diff --git a/public/media/github.png b/public/media/github.png new file mode 100644 index 0000000000000000000000000000000000000000..c61095c7d6b673a71d42e758934d04ab91c2f09e GIT binary patch literal 5325 zcmeI0_dgU4z{ibjXJzM9_8BEBTlP%G(Gjwpy$+X|bvWtDIy+~aJG-(s7a`-6y>~)f zqKxo-pTFaIKCjp3m-la<_m7_xGgEy4Juf{O85zLPK*xfNj9l`+3ei&jM@mTl#L37g zF3n89y7~bo|B?UC{~P!}Xh2$RujRkl*DwoHOEMbPyAL!>9Q-1ZG774i8fr3=qx~IC zHDv_ZXo0HF!}D9lHjXc^Pd15dMUhVGcj#_;rFYJqE_S2&i^qTc{#q8S#i<|H{(Z04 zT)AVP6#s~k_bFy+9e3OF<6(dZxAR|b28*LwmizLM)(hs@l?35z#mavM#zyb8#j0gF zQqK82egshyMh&w{pRMgmxr=VQV%g>9!{`U6Y{?f6z-BJXeR$Lh&^tmyXDEaX2iyaf3lEUisa91eu zNzPBD)WU6p( z^a}HOtoESD0Up2Hbrq|5)reV}ee0!YGXhiaKhNUZaueS#}` zTWoks;?3@EVtWPX&Uyof^|w$Q!uXji`a#Wy{-Ws%-=k3?|AD$oah+cZlc z(rNKGGkAA{gFEzqZfgGGM(H#?Zcb?AEHZt#voh{(mpSw?5jX%YK9-y+%`z3sULI^ez2(vA%`prs2k z0^r)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IKL|f5*C#uJ?k)%k2dFA?(fP_pahz^!A-P@y95H*Aw%(dgvx=OODaB z=2I%@8*&!KI($&LYJ6?f6&Y;m<-p)bY)_AwZv>gh7}gRmI-u<#8;938OWDo>hte^b z@CWBHMcR4v1n%6cQA#5*xqk4socNs*AoSDcYQ;;hBRn~#o~rvp)%dVNykqh`xkq&e zEc6AYx;IzBWB8Y)np^Fzz!2dIz3xF&sGU}7+#|!92&brb3-T+cZ-Se13 z3oir{=nz&(X`@r3ZMH8d`Eju-6*xJHCic>Rty@?-N|jD5DBE_l-EzBgRIA-RiMm_% zV0Ved*%7CoIW&cQP(uzszjsda^$t;#ZAuHVUXgZXkxd{1eGNU3s@$UR+0*BWbRHj~ zJ;!>YU6l+ zr#k8yeC3JvN1O=5W)l3Kt!6m+CXrJU?MI^?RR5IzL?(eaA!n5733rO3A~4q5Lh_x8 zrKahc?oWs9!n9H8L3yK0yTBE>11iIKo0(p^6u&Sj&46VR77<@<^Blo z^dL2S%+(-FN>s!{0<;q;qadoFLK%Cz7 z0C6r%q4L3g5L2Z73L2+1!$X{Ff>Z`Lb3}eQUFhPq{tX~0{Tg37?yv7#z!JE0(FF&= zhc;?7eNU~#G@ovlX?uKj*)b}-bNXS>9d@8_oNbmrX5T{o{Nb8(p$+rW;}Y5N=W#rn z-g=+0nql5QAlv0WIiEf`!yJ{4(U+>gofb~_uV;JU?Lb*x>K(p5Rp%IW+K)W;IE7&E z2>=3~8CpVLhu}Gzc|H)6z?4{2(D1bF^1v`>`o4?TZ|0S-_ySVEM3qL@J6g+Ifq1z1 zoR=VD!@cZRzJJaQA&-tnWTdU9q90Q@c3e|FT==R*tBP#?-#5xo*Houg%Q5bM0E@!I A-2eap literal 0 HcmV?d00001 diff --git a/src/app/(pages)/docs/[[...slug]]/page.tsx b/src/app/(pages)/docs/[[...slug]]/page.tsx index 7cdf974..21e6bf8 100644 --- a/src/app/(pages)/docs/[[...slug]]/page.tsx +++ b/src/app/(pages)/docs/[[...slug]]/page.tsx @@ -12,6 +12,8 @@ import { } from "@/app/components/ui/breadcrumb"; import { capitalizeFirstLetter } from "@/app/common/string-utils"; import { notFound } from "next/navigation"; +import { GithubLink } from "@/app/components/docs/github-link"; +import { cn } from "@/app/common/utils"; type DocumentationPageParams = { params: { @@ -56,33 +58,38 @@ export default function Page({ params: { slug } }: DocumentationPageParams) { } const slugParts = page.slug.split("/"); + const isHome = slugParts.length == 1; return (
- {slugParts.length > 1 && ( +
+ {/* The breadcrumb for the documentation page */} - Home + Home - {slugParts.map((slug, index, array) => { - const path: string = array.slice(0, index + 1).join("/"); - const name: string = slug.includes("-") - ? slug.split("-").map(capitalizeFirstLetter).join(" ") - : capitalizeFirstLetter(slug); + {!isHome && + slugParts.map((slug, index, array) => { + const path: string = array.slice(0, index + 1).join("/"); + const name: string = slug.includes("-") + ? slug.split("-").map(capitalizeFirstLetter).join(" ") + : capitalizeFirstLetter(slug); - return ( -
- - - {capitalizeFirstLetter(name)} - -
- ); - })} + return ( +
+ + + {capitalizeFirstLetter(name)} + +
+ ); + })}
- )} + + +
{/* The documentation page title and description */}
diff --git a/src/app/(pages)/docs/layout.tsx b/src/app/(pages)/docs/layout.tsx index c5d042b..90653f7 100644 --- a/src/app/(pages)/docs/layout.tsx +++ b/src/app/(pages)/docs/layout.tsx @@ -1,5 +1,6 @@ import React, { ReactElement } from "react"; import { Search } from "@/app/components/docs/search"; +import { Sidebar } from "@/app/components/docs/sidebar"; export default function RootLayout({ children, @@ -8,7 +9,7 @@ export default function RootLayout({ }>): ReactElement { return (
- + {children}
); diff --git a/src/app/components/docs/github-link.tsx b/src/app/components/docs/github-link.tsx new file mode 100644 index 0000000..78a7fb6 --- /dev/null +++ b/src/app/components/docs/github-link.tsx @@ -0,0 +1,22 @@ +import { DocsContentMetadata } from "@/app/common/documentation"; +import { ReactElement } from "react"; +import Image from "next/image"; +import Link from "next/link"; + +type GithubLink = { + /** + * The page to link to. + */ + page: DocsContentMetadata; +}; + +export function GithubLink({ page }: GithubLink): ReactElement { + return ( + + The GitHub logo + + ); +} diff --git a/src/app/components/docs/sidebar.tsx b/src/app/components/docs/sidebar.tsx new file mode 100644 index 0000000..aeb5f46 --- /dev/null +++ b/src/app/components/docs/sidebar.tsx @@ -0,0 +1,10 @@ +import { Search } from "@/app/components/docs/search"; +import { ReactElement } from "react"; + +export function Sidebar(): ReactElement { + return ( +
+ +
+ ); +}