mobile navbar and spacing fixes

This commit is contained in:
ari melody 2023-11-28 02:07:29 +00:00
parent c192350bc0
commit 084cd44908
Signed by: ari
GPG key ID: CF99829C92678188
4 changed files with 90 additions and 9 deletions

View file

@ -32,7 +32,14 @@
<h1>ari melody</h1> <h1>ari melody</h1>
<h2>your local SPACEGIRL 💫</h2> <h2>your local SPACEGIRL 💫</h2>
</div> </div>
<ul> <a id="header-links-toggle" onclick="toggle_header_links()">
<svg viewBox="0 0 70 50" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
<rect y="00" width="70" height="10" rx="5" fill="#eee" />
<rect y="20" width="70" height="10" rx="5" fill="#eee" />
<rect y="40" width="70" height="10" rx="5" fill="#eee" />
</svg>
</a>
<ul id="header-links">
<li> <li>
<a href="/">home</a> <a href="/">home</a>
</li> </li>
@ -62,6 +69,7 @@
# hello, world! # hello, world!
</h1> </h1>
<p> <p>
<strong>i'm ari!</strong> <strong>i'm ari!</strong>
<br> <br>

View file

@ -33,7 +33,14 @@
<h1>ari melody</h1> <h1>ari melody</h1>
<h2>your local SPACEGIRL 💫</h2> <h2>your local SPACEGIRL 💫</h2>
</div> </div>
<ul> <a id="header-links-toggle" onclick="toggle_header_links()">
<svg viewBox="0 0 70 50" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
<rect y="00" width="70" height="10" rx="5" fill="#eee" />
<rect y="20" width="70" height="10" rx="5" fill="#eee" />
<rect y="40" width="70" height="10" rx="5" fill="#eee" />
</svg>
</a>
<ul id="header-links">
<li> <li>
<a href="/">home</a> <a href="/">home</a>
</li> </li>

View file

@ -1,3 +1,6 @@
const header_links = document.getElementById("header-links");
const hamburger = document.getElementById("header-links-toggle");
function type_out(e) { function type_out(e) {
const text = e.innerText; const text = e.innerText;
const original = e.innerHTML; const original = e.innerHTML;
@ -52,3 +55,12 @@ function fill_list(list) {
fill_list(e); fill_list(e);
}); });
function toggle_header_links() {
header_links.classList.toggle("open");
}
document.addEventListener("click", event => {
if (!header_links.contains(event.target) && !hamburger.contains(event.target)) {
header_links.classList.remove("open");
}
});

View file

@ -29,17 +29,23 @@ body {
} }
header { header {
position: fixed;
top: 0;
left: 0;
width: 100vw;
border-bottom: 1px solid #888; border-bottom: 1px solid #888;
background-color: #080808;
} }
#header { #header {
width: min(calc(100% - 4rem), 720px); width: min(calc(100% - 4rem), 720px);
height: 3em; height: 3em;
margin: auto; margin: auto;
padding: 0 1em;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 1em; gap: .8em;
padding: 0 1em; align-items: center;
} }
img#header-icon { img#header-icon {
@ -51,9 +57,11 @@ img#header-icon {
#header-text { #header-text {
width: 11em; width: 11em;
margin-left: -0.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
flex-grow: 1;
} }
#header-text h1 { #header-text h1 {
@ -69,13 +77,17 @@ img#header-icon {
color: #bbb; color: #bbb;
} }
header ul { a#header-links-toggle {
width: 1.8rem;
display: none;
}
header ul#header-links {
margin: 0; margin: 0;
padding: 0; padding: 0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: .5em; gap: .5em;
/* overflow-x: scroll; */
align-items: center; align-items: center;
} }
@ -130,7 +142,7 @@ header ul li a:hover {
main { main {
width: min(calc(100% - 4rem), 720px); width: min(calc(100% - 4rem), 720px);
min-height: calc(100vh - 10.3rem); min-height: calc(100vh - 10.3rem);
margin: auto; margin: 5rem auto 2rem auto;
} }
main h1 { main h1 {
@ -363,13 +375,55 @@ footer {
mix-blend-mode: overlay; mix-blend-mode: overlay;
} }
@media screen and (max-width: 740px) { @media screen and (max-width: 780px) {
body { body {
font-size: 14px; font-size: 14px;
} }
#header-text { div#header {
width: calc(100vw - 2rem);
margin: 0;
}
div#header-text {
flex-grow: 1;
}
a#header-links-toggle {
display: flex;
}
header ul#header-links {
position: fixed;
left: 0;
top: 2.7rem;
width: calc(100vw - 2rem);
padding: 1rem;
flex-direction: column;
gap: 1rem;
border-bottom: 1px solid #888;
background: #080808;
display: none; display: none;
} }
header ul#header-links.open {
display: flex;
}
ul#header-links li {
width: 100%;
}
ul#header-links li a,
ul#header-links li span {
margin: 0;
display: block;
font-size: 1rem;
text-align: center;
}
main {
margin-top: 4rem;
}
} }