From d6d34b1fc2dccdd2886f940a988e8771e310caa5 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sat, 8 Oct 2022 13:35:40 +0200 Subject: [PATCH] Both diary navs (will be selected in css) --- components/Blog/DiaryPageSelector.tsx | 28 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/components/Blog/DiaryPageSelector.tsx b/components/Blog/DiaryPageSelector.tsx index 32e6d81..0d1785f 100644 --- a/components/Blog/DiaryPageSelector.tsx +++ b/components/Blog/DiaryPageSelector.tsx @@ -6,18 +6,22 @@ import { useEffect } from "react"; import styles from "../../styles/Blog/DiaryPageSelector.module.scss"; -interface IContentNavBar { +interface IContent { pages: string[]; name: string; title: string; pageSelected: number } -interface IContentNav extends IContentNavBar { +interface IContentNavBar extends IContent { + mobile?: boolean; +} + +interface IContentNav extends IContent { bottom?: boolean; } -const PageSelectorBar: NextPage = ({ pages, name, title, pageSelected }) => { +const PageSelectorBar: NextPage = ({ pages, name, title, pageSelected, mobile }) => { const router = useRouter(); // When we are on the main page no previous page exists, otherwise we need to check if the previous page is the main page @@ -46,8 +50,10 @@ const PageSelectorBar: NextPage = ({ pages, name, title, pageSel ); + const classNames = mobile ? `${styles.barNav} ${styles.mobile}` : styles.barNav; + return ( -
+
{prev}   |   {select} @@ -62,11 +68,15 @@ const PageSelector: NextPage = (content) => { if (content.bottom) return ; return ( -
-

{content.title}

-
    - {content.pages.map((e, idx) =>
  • {e}
  • )} -
+
+ + +
+

{content.title}

+
    + {content.pages.map((e, idx) =>
  • {e}
  • )} +
+
); };