Tentative 1 for Mobile navigation menu

This commit is contained in:
Alex 2022-12-22 00:07:05 +01:00
parent 73d4b846ec
commit 719c8cf493
No known key found for this signature in database
GPG Key ID: 09EC5284AA804D3C
4 changed files with 157 additions and 35 deletions

View File

@ -1,14 +1,16 @@
.heading-text { .heading-text {
font-family: "Fira Sans", sans-serif; font-family: "Fira Sans", sans-serif;
font-size: 32px; font-size: 2em;
font-weight: 600; font-weight: 600;
line-height: 1.2em;
padding: 10px 0 25px 0; padding: 10px 0 25px 0;
color: var(--secondary-text-color); color: var(--secondary-text-color);
} }
h1, .title-text { h1, .title-text {
font-family: "Fira Sans", sans-serif; font-family: "Fira Sans", sans-serif;
font-size: 25px; font-size: 1.8em;
line-height: 1.2em;
font-weight: 500; font-weight: 500;
color: var(--secondary-text-color); color: var(--secondary-text-color);
border-left: var(--primary-color) 8px solid; border-left: var(--primary-color) 8px solid;
@ -17,7 +19,7 @@ h1, .title-text {
h2, .title-text { h2, .title-text {
font-family: "Fira Sans", sans-serif; font-family: "Fira Sans", sans-serif;
font-size: 25px; font-size: 1.5em;
font-weight: 500; font-weight: 500;
color: var(--secondary-text-color); color: var(--secondary-text-color);
border-left: #aaa 8px solid; border-left: #aaa 8px solid;
@ -26,14 +28,14 @@ h2, .title-text {
h3, .subtitle-text { h3, .subtitle-text {
font-family: "Fira Sans", sans-serif; font-family: "Fira Sans", sans-serif;
font-size: 20px; font-size: 1.3em;
font-weight: 500; font-weight: 500;
color: var(--secondary-text-color); color: var(--secondary-text-color);
} }
.text { .text {
font-family: "Fira Sans", sans-serif; font-family: "Fira Sans", sans-serif;
font-size: 18px; font-size: 16px;
font-weight: 400; font-weight: 400;
line-height: 26px; line-height: 26px;
letter-spacing: 0.2px; letter-spacing: 0.2px;

View File

@ -38,9 +38,20 @@ header {
justify-content: space-between; justify-content: space-between;
} }
header ul {
margin: 0px;
padding: 0px;
list-style: none;
}
header ul li {
display: inline;
}
.logo { .logo {
font-family: Georgia, DejaVu Serif, Norasi, serif; font-family: Georgia, DejaVu Serif, Norasi, serif;
font-size: 32px; font-size: 28px;
color: var(--primary-text-color); color: var(--primary-text-color);
font-weight: 500; font-weight: 500;
display: flex; display: flex;
@ -56,7 +67,6 @@ header {
.nav-item { .nav-item {
margin: 0 10px; margin: 0 10px;
text-decoration: none; text-decoration: none;
font-size: 18px;
font-weight: bold; font-weight: bold;
color: var(--primary-text-color); color: var(--primary-text-color);
@ -83,10 +93,12 @@ header {
} }
} }
main { main {
display: flex; display: flex;
padding: 50px 100px;
flex-grow: 1; flex-grow: 1;
padding: 50px 100px;
margin: 0;
.toc { .toc {
max-width: 260px; max-width: 260px;
@ -123,7 +135,6 @@ main {
padding: 0 30px 5px; padding: 0 30px 5px;
color: #424242; color: #424242;
} }
} }
.toc-sticky { .toc-sticky {
@ -156,20 +167,36 @@ footer {
} }
} }
main details#navigation-toggle summary {
display: none;
}
@media screen and (min-width: 1280px) { @media screen and (min-width: 1280px) {
.logo {
font-size: 32px;
}
.content { .content {
max-width: 60%; max-width: 60%;
min-width: 800px; min-width: 800px;
overflow: hidden; overflow: hidden;
} }
.text {
font-size: 18px;
}
} }
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
header { header {
padding: 10px 30px; padding: 10px 20px;
flex-direction: column; display: block;
align-items: center; }
justify-content: center;
header nav {
display: none;
}
header ul li {
display: block;
} }
.logo { .logo {
@ -184,7 +211,7 @@ footer {
.nav-item { .nav-item {
margin: 0 5px; margin: 0 5px;
font-size: 14px; font-size: 1em;
} }
.hero { .hero {
@ -192,15 +219,98 @@ footer {
} }
main { main {
padding: 30px; display: block;
padding: 0px;
}
main .toc {
margin: 0px;
width: 100%;
max-width: none;
border: 0px;
}
main .toc-sticky {
border: 0px;
}
main .content {
margin: 15px;
} }
.content { .content {
padding: 0; padding: 0;
display: block;
} }
.explore-more, .toc { .explore-more {
display: none; display: none;
} }
} }
/* *********** */
.menu-button-container {
display: none;
}
#menu-toggle {
display: none;
}
.menu-button,
.menu-button::before,
.menu-button::after {
display: block;
background-color: #fff;
position: absolute;
height: 4px;
width: 30px;
transition: transform 400ms ease;
border-radius: 2px;
}
.menu-button::before {
content: '';
transform: translate(0, -8px);
}
.menu-button::after {
content: '';
transform: translate(0, 8px);
}
#menu-toggle:checked + .menu-button-container .menu-button::before {
margin-top: 0px;
transform: rotate(45deg);
}
#menu-toggle:checked + .menu-button-container .menu-button {
background: transparent;
}
#menu-toggle:checked + .menu-button-container .menu-button::after {
margin-top: 0px;
transform: rotate(-45deg);
}
@media (max-width: 768px) {
.menu-button-container {
position: absolute;
display: block;
height: 32px;
width: 32px;
top: 40px;
right: 24px;
}
#menu-toggle ~ .toc {
display: none;
}
#menu-toggle:checked ~ .toc {
display: block;
}
}

View File

@ -1,5 +1,7 @@
{% macro render_header() %} {% macro render_header() %}
{% set section = get_section(path="_index.md") %} {% set section = get_section(path="_index.md") %}
<a href="{{ section.permalink }}"> <a href="{{ section.permalink }}">
<div class="logo"> <div class="logo">
<img src="{{ get_url(path=config.extra.juice_logo_path) }}" alt="logo"> <img src="{{ get_url(path=config.extra.juice_logo_path) }}" alt="logo">
@ -8,14 +10,16 @@
</a> </a>
<nav> <nav>
{% for subpath in section.subsections %} <ul>
{% set sub = get_section(path=subpath) %} {% for subpath in section.subsections %}
<a class="nav-item subtitle-text" href="{{ sub.permalink }}">{{ sub.title }}</a> {% set sub = get_section(path=subpath) %}
{% endfor %} <li><a class="nav-item text" href="{{ sub.permalink }}">{{ sub.title }}</a></li>
{% if config.extra.juice_extra_menu %}
{% for menu in config.extra.juice_extra_menu %}
<a class="nav-item subtitle-text" href="{{ menu.link }}">{{ menu.title }}</a>
{% endfor %} {% endfor %}
{% endif %} {% if config.extra.juice_extra_menu %}
{% for menu in config.extra.juice_extra_menu %}
<li><a class="nav-item text" href="{{ menu.link }}">{{ menu.title }}</a></li>
{% endfor %}
{% endif %}
</ul>
</nav> </nav>
{% endmacro render_header %} {% endmacro render_header %}

View File

@ -19,23 +19,29 @@
<body> <body>
{% block header %} {% block header %}
<header class="box-shadow"> <header class="box-shadow top-nav">
{{ macros::render_header() }} {{ macros::render_header() }}
</header> </header>
{% endblock header %} {% endblock header %}
<main> <main>
{% block toc %} {% block mainnav %}
<div class="toc"> {% if page.ancestors or section.ancestors %}
<div class="toc-sticky"> <input id="menu-toggle" type="checkbox" {% if section.subsections or section.pages %}checked{% endif %} />
{% if page %} <label class='menu-button-container' for="menu-toggle">
{{ nav::navmenu(current=page) }} <div class='menu-button'></div>
{% else %} </label>
{{ nav::navmenu(current=section) }} <div class="toc" id="navigation">
<div class="toc-sticky">
{% if page %}
{{ nav::navmenu(current=page) }}
{% else %}
{{ nav::navmenu(current=section) }}
{% endif %}
</div>
</div>
{% endif %} {% endif %}
</div> {% endblock mainnav %}
</div>
{% endblock toc %}
<div class="content text"> <div class="content text">
{% block content %} {% block content %}