diff --git a/public/favicon.ico b/public/favicon.ico index 718d6fe..ff1bcd9 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/src/lib/format.ts b/src/lib/format.ts new file mode 100644 index 0000000..158372d --- /dev/null +++ b/src/lib/format.ts @@ -0,0 +1,7 @@ +// Format the title of the page +import { getAppName } from "@/lib/data"; + +export function formatTitle(title: string = ""): string { + if (!title) return getAppName(); + return `${title} | ${getAppName()}`; +} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index d39996f..4c97153 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,5 +1,12 @@ import { type ClassValue, clsx } from "clsx"; +import config from "../../next.config.mjs"; + export function cn(...inputs: ClassValue[]) { return clsx(inputs); } + +export function assetUrl(path: string) { + if (!config.basePath) return path; + return `${config.basePath}${path}`; +} diff --git a/src/pages/[quadrant]/index.tsx b/src/pages/[quadrant]/index.tsx index deea09a..3710118 100644 --- a/src/pages/[quadrant]/index.tsx +++ b/src/pages/[quadrant]/index.tsx @@ -2,15 +2,20 @@ import Head from "next/head"; import { useRouter } from "next/router"; import { getQuadrant, getQuadrants } from "@/lib/data"; +import { formatTitle } from "@/lib/format"; import { CustomPage } from "@/pages/_app"; const QuadrantPage: CustomPage = () => { const { query } = useRouter(); const quadrant = getQuadrant(query.quadrant as string); + + if (!quadrant) return null; + return ( <> - Quadrant Page + {formatTitle(quadrant.title)} +

Quadrant: {query.quadrant}

diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index d634e6d..5a762be 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,7 +1,10 @@ import { NextPage } from "next"; import type { AppProps } from "next/app"; +import Head from "next/head"; import { Layout, type LayoutClass } from "@/components/Layout/Layout"; +import { formatTitle } from "@/lib/format"; +import { assetUrl } from "@/lib/utils"; import "@/styles/globals.css"; export type CustomPage

= NextPage & { @@ -14,8 +17,15 @@ type CustomAppProps = AppProps & { export default function App({ Component, pageProps, router }: CustomAppProps) { return ( - - - + <> + + {formatTitle()} + + + + + + + ); } diff --git a/src/pages/help-and-about-tech-radar.tsx b/src/pages/help-and-about-tech-radar.tsx index f696b03..d90dc28 100644 --- a/src/pages/help-and-about-tech-radar.tsx +++ b/src/pages/help-and-about-tech-radar.tsx @@ -1,14 +1,13 @@ import Head from "next/head"; +import { formatTitle } from "@/lib/format"; import { CustomPage } from "@/pages/_app"; const HelpAndAbout: CustomPage = () => { return ( <> - Help and About - - + {formatTitle("Help and About")}

Help and about

diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 3f32aef..a007d61 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,20 +1,7 @@ -import Head from "next/head"; - import { CustomPage } from "@/pages/_app"; const Home: CustomPage = () => { - return ( - <> - - Create Next App - - - - - -

Hello world.

- - ); + return

Hello world.

; }; export default Home;