Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mobile menu (merges into dark mode pr) #983

Open
wants to merge 3 commits into
base: simon/dark-theme-support
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions _includes/menu-items.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<li><a href="../{{page.lang}}/">{%if tx.menu.home != ""%}{{ tx.menu.home }}{%else%}{{ txEn.menu.home }}{%endif%}</a></li>
<li><a href="download">{%if tx.menu.download != ""%}{{ tx.menu.download }}{%else%}{{ txEn.menu.download }}{%endif%}</a></li>
<li><a href="blog">{%if tx.menu.blog != ""%}{{ tx.menu.blog }}{%else%}{{ txEn.menu.blog }}{%endif%}</a></li>
<li><a href="contribute">{%if tx.menu.contribute != ""%}{{ tx.menu.contribute }}{%else%}{{ txEn.menu.contribute }}{%endif%}</a></li>
<li><a href="help">{%if tx.menu.help != ""%}{{ tx.menu.help }}{%else%}{{ txEn.menu.help }}{%endif%}</a></li>
<li><a href="https://support.delta.chat">{%if tx.menu.forum != ""%}{{ tx.menu.forum }}{%else%}{{ txEn.menu.forum }}{%endif%}</a></li>
26 changes: 17 additions & 9 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,25 @@

<body id="top">

<div id="menu">
<ul>
<nav class="menu">
<ul class="desktop-menu-items">
<li aria-hidden="true"><a href="../{{page.lang}}/"><img src="../assets/logos/delta-chat.svg" width="32" height="32" style="position: relative; bottom: -3px;" /></a></li>
<li><a href="../{{page.lang}}/">{%if tx.menu.home != ""%}{{ tx.menu.home }}{%else%}{{ txEn.menu.home }}{%endif%}</a></li>
<li><a href="download">{%if tx.menu.download != ""%}{{ tx.menu.download }}{%else%}{{ txEn.menu.download }}{%endif%}</a></li>
<li><a href="blog">{%if tx.menu.blog != ""%}{{ tx.menu.blog }}{%else%}{{ txEn.menu.blog }}{%endif%}</a></li>
<li><a href="contribute">{%if tx.menu.contribute != ""%}{{ tx.menu.contribute }}{%else%}{{ txEn.menu.contribute }}{%endif%}</a></li>
<li><a href="help">{%if tx.menu.help != ""%}{{ tx.menu.help }}{%else%}{{ txEn.menu.help }}{%endif%}</a></li>
<li><a href="https://support.delta.chat">{%if tx.menu.forum != ""%}{{ tx.menu.forum }}{%else%}{{ txEn.menu.forum }}{%endif%}</a></li>
{% include menu-items.html %}
</ul>
</div>
{% comment %} critical styles - so that both menus are not shown at once {% endcomment %}
<style>.mobile-menu-items, .mobile-menu {display: none;}</style>
<ul class="mobile-menu-items">
<li aria-hidden="true"><a href="../{{page.lang}}/" style="display: flex;align-items: center;"><img src="../assets/logos/delta-chat.svg" width="32" height="32" style="margin-inline:0.4rem" /> Delta Chat</a></li>
<li style="flex-grow: 1"></li>
<li><label for="menu" id="open-menu">Menu</label></li>
</ul>
<input type="checkbox" style="display: none;" id="menu" />
<nav class="mobile-menu" id="mobile-menu">
<ul>
{% include menu-items.html %}
</ul>
</nav>
</nav>

<div id="content">

Expand Down
57 changes: 49 additions & 8 deletions _sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ body {
padding-top: 0px;
}

#menu {
.menu {
text-align: center;
margin-bottom: 1em;
padding: 8px 5px;
Expand All @@ -62,25 +62,66 @@ body {
background: var(--menu-bg);
}

#menu ul {
.menu .desktop-menu-items {
display: flex;
}
.menu .desktop-menu-items,
.menu .mobile-menu-items {
align-items: center;
justify-content: center;
flex-wrap: wrap;
}

#menu li {
.menu li {
display: inline-block;
padding-right: 0.5em;

a,
a:visited {
a:visited, label {
color: #fff;
color: var(--menu-text);
font-size: 16px;
}
}

@media only screen and (max-width: 640px) {
.menu {
.desktop-menu-items {
display: none;
}
.mobile-menu-items {
display: flex;
}
}
}

.mobile-menu {
margin-inline: auto;
width: 95vw;
padding: 5px;
ul {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex-wrap: wrap;
color: #fff;
color: var(--menu-text);
li {
a {
font-size: 2rem;
line-height: 2rem;
}
margin: 0.4rem;
}
margin: 1rem;
}
}

#menu:checked ~ .mobile-menu {
display: block;
}

#content {
padding: 0em 1em 0.5em 1em;
}
Expand Down Expand Up @@ -149,10 +190,10 @@ body {
body {
padding-top: 0px;
}
#menu {
.menu {
padding: 10px 0;
}
#menu li {
.menu li {
padding-right: 1em;

a,
Expand Down Expand Up @@ -239,7 +280,7 @@ body {
background-color: var(--bg);
}

#menu,
.menu,
h1,
h2,
h3,
Expand Down Expand Up @@ -354,7 +395,7 @@ code {
h1,
h2,
h3,
h4,
h4,a
h5,
h6 {
&:hover {
Expand Down
Loading