From bdf7dfdc3cfa8def4f967547cddf76a5ade993ee Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Tue, 18 Oct 2022 14:05:45 +0200 Subject: [PATCH] DiaryPageSelector styling --- components/Blog/ContentPage.tsx | 4 +- components/Blog/DiaryPageSelector.tsx | 17 ++-- styles/Blog/Blog.module.scss | 2 +- styles/Blog/DiaryPageSelector.module.scss | 112 ++++++++++++++++++++++ 4 files changed, 125 insertions(+), 10 deletions(-) diff --git a/components/Blog/ContentPage.tsx b/components/Blog/ContentPage.tsx index 97f6baa..16a97cd 100644 --- a/components/Blog/ContentPage.tsx +++ b/components/Blog/ContentPage.tsx @@ -4,10 +4,10 @@ import DiaryPageSelector from "./DiaryPageSelector"; const ContentPage: NextPage<{ content: ProjectRender | DiaryRender }> = ({ content }) => { return (<> - {content.type === "diary" ? : null} + {content.type === "diary" ? : null}
- {content.type === "diary" ? : null} + {content.type === "diary" ? : null} ); }; diff --git a/components/Blog/DiaryPageSelector.tsx b/components/Blog/DiaryPageSelector.tsx index 1b4be56..5363510 100644 --- a/components/Blog/DiaryPageSelector.tsx +++ b/components/Blog/DiaryPageSelector.tsx @@ -15,6 +15,7 @@ interface IContent { interface IContentNavBar extends IContent { mobile?: boolean; + bottom?: boolean; pages: string[]; } @@ -23,7 +24,7 @@ interface IContentNav extends IContent { pages: DiaryEntry[]; } -const PageSelectorBar: NextPage = ({ pages, name, title, pageSelected, mobile }) => { +const PageSelectorBar: NextPage = ({ pages, name, title, pageSelected, mobile, bottom }) => { 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 @@ -52,15 +53,17 @@ const PageSelectorBar: NextPage = ({ pages, name, title, pageSel ); - const classNames = mobile ? `${styles.barNav} ${styles.mobile}` : styles.barNav; + const classNames = `${styles.barNav} ${mobile ? styles.mobile : ""} ${bottom ? styles.bottom : styles.top}`; return (
+ {/* Spacer */} {prev}   |   {select}   |   {next} + {/* Spacer */}
); }; @@ -68,17 +71,17 @@ const PageSelectorBar: NextPage = ({ pages, name, title, pageSel const PageSelector: NextPage = (content) => { const entries = content.pages.map(p => p.title); - if (content.bottom) return ; + if (content.bottom) return ; return (
-

{content.title}

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

{content.title}

+
    + {entries.map((e, idx) =>
  1. {e}
  2. )} +
); diff --git a/styles/Blog/Blog.module.scss b/styles/Blog/Blog.module.scss index 2ef67c7..c7811eb 100644 --- a/styles/Blog/Blog.module.scss +++ b/styles/Blog/Blog.module.scss @@ -15,6 +15,7 @@ border: 1px solid var(--blog_content-border); background: var(--blog_content-background); backdrop-filter: blur(var(--blog_content-blur)); + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } main { @@ -30,7 +31,6 @@ } footer { - margin: 5px auto 0; padding: 20px; border-bottom-left-radius: 1em; diff --git a/styles/Blog/DiaryPageSelector.module.scss b/styles/Blog/DiaryPageSelector.module.scss index e69de29..81a4864 100644 --- a/styles/Blog/DiaryPageSelector.module.scss +++ b/styles/Blog/DiaryPageSelector.module.scss @@ -0,0 +1,112 @@ +.sideNav { + float: right; + background: transparent; + /* 50px padding in main */ + margin-right: -50px; + margin-top: -50px; + padding: 20px; + border-bottom-left-radius: 1em; + border-top-right-radius: 1em; + border: none; + border-left: 1px solid var(--blog_content-border); + + h4 { + margin: 0 0 10px 0; + } + + ol { + list-style-type: "\1405\0020\0020"; + list-style-position: inside; + margin: 0; + padding: 0; + } + + li { + margin: 0; + padding: 0; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + width: 200px; + } + + li:hover { + &::marker { + font-weight: bold; + } + } + + a:link, a:visited, a:hover, a:active { + color: inherit; + text-decoration: none; + } + + li.thisPage { + font-weight: bold; + } + + h4.thisPage, h4:hover { + text-decoration: underline; + } +} + +.barNav { + display: grid; + grid-template-columns: 1fr max-content max-content max-content max-content max-content 1fr; + align-items: center; + background: transparent; + padding: 10px; + + select { + font-size: 110%; + padding: 5px; + border-radius: 1em; + border: 1px solid var(--blog_content-border); + background: #333; + } + + &.top { + margin: -50px -50px 20px; + border-bottom: 1px solid var(--blog_content-border); + } + + &.bottom { + margin: 20px -50px -50px; + border-top: 1px solid var(--blog_content-border); + } + + a:link, a:visited, a:active { + color: inherit; + text-decoration: none; + font-weight: bold; + } + a:hover { + text-decoration: underline; + } +} + +/* TODO: Move to asciidoc footer in Content.module.scss */ +.bottom { + clear: both; +} + + +/* To bottom as this should override everything */ + +.mobile { + display: none; +} + +.desktop { + display: block; +} + +@media screen and (max-width: 900px) { + .mobile { + display: grid; + } + + .desktop { + display: none; + } +} \ No newline at end of file