From 5df8ae8d09fa96e998b2d1b2c636d8f3b5842eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vikt=C3=B3ria=20Brezinov=C3=A1?= <52294703+vikibrezinova@users.noreply.github.com> Date: Sat, 9 Dec 2023 11:59:26 +0100 Subject: [PATCH] Add head-title to pages (#252) * add titles to pages * import Seminar type and resolve optional title --- src/components/PageLayout/PageLayout.tsx | 57 ++++++++++++++-------- src/pages/malynar/index.tsx | 2 +- src/pages/matik/index.tsx | 2 +- src/pages/strom/index.tsx | 2 +- src/pages/strom/vysledky/[[...params]].tsx | 2 +- src/pages/strom/zadania/[[...params]].tsx | 2 +- 6 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/components/PageLayout/PageLayout.tsx b/src/components/PageLayout/PageLayout.tsx index 58900e72..0173c82c 100644 --- a/src/components/PageLayout/PageLayout.tsx +++ b/src/components/PageLayout/PageLayout.tsx @@ -1,8 +1,10 @@ import clsx from 'clsx' +import Head from 'next/head' import {FC, ReactNode} from 'react' import {BannerContainer} from '@/utils/BannerContainer' import {PageTitleContainer} from '@/utils/PageTitleContainer' +import {Seminar, useSeminarInfo} from '@/utils/useSeminarInfo' import {Footer} from './Footer/Footer' import {MenuMain} from './MenuMain/MenuMain' @@ -16,31 +18,46 @@ type PageLayoutProps = { children: ReactNode } +const seminarTitle: Record = { + strom: 'STROM', + matik: 'Matik', + malynar: 'Malynár', +} + // pre pouzitie len na seminarovych strankach a podstrankach - `/matik(/*)` // ked budeme potrebovat top-level stranky ako `/ina-stranka`, budeme musiet upravit, ako sa pracuje s `useSeminarInfo` export const PageLayout: FC = ({contentWidth = 2, title = '', children}) => { + const {seminar} = useSeminarInfo() return ( - - -
- - -
- -
- {children} + <> + + + {title && `${title} | `} + {seminarTitle[seminar]} + + + + +
+ + +
+ +
+ {children} +
+
-
-
- - + + + ) } diff --git a/src/pages/malynar/index.tsx b/src/pages/malynar/index.tsx index e99819c7..286b5f7e 100644 --- a/src/pages/malynar/index.tsx +++ b/src/pages/malynar/index.tsx @@ -4,7 +4,7 @@ import {PageLayout} from '@/components/PageLayout/PageLayout' import {Posts} from '@/components/Posts/Posts' const Malynar: NextPage = () => ( - + ) diff --git a/src/pages/matik/index.tsx b/src/pages/matik/index.tsx index 22cf6497..7715ecc2 100644 --- a/src/pages/matik/index.tsx +++ b/src/pages/matik/index.tsx @@ -4,7 +4,7 @@ import {PageLayout} from '@/components/PageLayout/PageLayout' import {Posts} from '@/components/Posts/Posts' const Matik: NextPage = () => ( - + ) diff --git a/src/pages/strom/index.tsx b/src/pages/strom/index.tsx index b89e4982..52345e36 100644 --- a/src/pages/strom/index.tsx +++ b/src/pages/strom/index.tsx @@ -4,7 +4,7 @@ import {PageLayout} from '@/components/PageLayout/PageLayout' import {Posts} from '@/components/Posts/Posts' const Strom: NextPage = () => ( - + ) diff --git a/src/pages/strom/vysledky/[[...params]].tsx b/src/pages/strom/vysledky/[[...params]].tsx index b5552fe4..5208be76 100644 --- a/src/pages/strom/vysledky/[[...params]].tsx +++ b/src/pages/strom/vysledky/[[...params]].tsx @@ -5,7 +5,7 @@ import {Results} from '@/components/Results/Results' const Vysledky: NextPage = () => { return ( - + ) diff --git a/src/pages/strom/zadania/[[...params]].tsx b/src/pages/strom/zadania/[[...params]].tsx index ab0bd57c..cd3a049d 100644 --- a/src/pages/strom/zadania/[[...params]].tsx +++ b/src/pages/strom/zadania/[[...params]].tsx @@ -5,7 +5,7 @@ import {Problems} from '@/components/Problems/Problems' const Zadania: NextPage = () => { return ( - + )