mirror of
https://github.com/kristoferssolo/kristofersxyz.git
synced 2025-10-21 18:30:34 +00:00
Remade navigation bar
This commit is contained in:
parent
4feb2383bd
commit
16f7dbd235
@ -1,13 +1,14 @@
|
||||
main {
|
||||
border: 1px solid #30363d;
|
||||
border: var(--border);
|
||||
border-radius: var(--border-radius);
|
||||
max-width: 700px;
|
||||
color: #f0f6fc;
|
||||
color: var(--text-color);
|
||||
padding: 50px;
|
||||
margin: 100px auto 100px auto;
|
||||
}
|
||||
|
||||
hr {
|
||||
color: #30363d;
|
||||
color: var(--hr-color);
|
||||
}
|
||||
|
||||
h1 {
|
||||
@ -30,7 +31,7 @@ p {
|
||||
a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #58a6ff;
|
||||
color: var(--link-text-color);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
@ -39,14 +40,14 @@ a:hover {
|
||||
|
||||
code {
|
||||
font-family: Consolas, "courier new";
|
||||
color: #f0f6fc;
|
||||
background-color: #393f48;
|
||||
border-radius: 8px;
|
||||
color: var(--text-color);
|
||||
background-color: var(--code-bg-color);
|
||||
border-radius: var(--border-radius);
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: #161b22;
|
||||
background-color: var(--bg);
|
||||
display: block;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
p {
|
||||
color: #f0f6fc;
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #58a6ff;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.center {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
/* h1, */
|
||||
/* p { */
|
||||
/* color: var(--text-color); */
|
||||
/* font-size: 20px; */
|
||||
/* text-align: center; */
|
||||
/* margin-top: 10px; */
|
||||
/* } */
|
||||
/**/
|
||||
/* a { */
|
||||
/* text-decoration: none; */
|
||||
/* color: var(--link-text-color); */
|
||||
/* } */
|
||||
/**/
|
||||
/* a:hover { */
|
||||
/* text-decoration: underline; */
|
||||
/* } */
|
||||
/**/
|
||||
/* .center { */
|
||||
/* margin: 0; */
|
||||
/* position: absolute; */
|
||||
/* top: 50%; */
|
||||
/* left: 50%; */
|
||||
/* -ms-transform: translate(-50%, -50%); */
|
||||
/* transform: translate(-50%, -50%); */
|
||||
/* } */
|
||||
|
||||
@ -1,68 +1,158 @@
|
||||
:root {
|
||||
--bg: #0d1117;
|
||||
--bg-accent: #1a1e25;
|
||||
--border-radius: 8px;
|
||||
--border: 1px solid #30363d;
|
||||
--hover-text-color: #b9bbbd;
|
||||
--hr-color: #30363d;
|
||||
--link-text-color: #58a6ff;
|
||||
--nav-size: 60px;
|
||||
--speed: 500ms;
|
||||
--text-color: #f0f6fc;
|
||||
--code-bg-color: #393f48;
|
||||
--ff-sans-normal: "Roboto", sans-serif;
|
||||
--fs-16: 16px;
|
||||
--fs-20: 20px;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #0d1117;
|
||||
font-family: var(--ff-sans-normal);
|
||||
color: var(--text-color);
|
||||
background-color: var(--bg);
|
||||
line-height: 1.5;
|
||||
min-height: 100vh;
|
||||
min-width: 300px;
|
||||
|
||||
display: grid;
|
||||
grid-template-rows: min-content 1fr;
|
||||
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
main {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
/* HEADER */
|
||||
|
||||
header ul {
|
||||
width: 100%;
|
||||
list-style-type: none;
|
||||
overflow: hidden;
|
||||
background-color: #161b22;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
header li {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 24px;
|
||||
float: left;
|
||||
width: calc(100% / 2);
|
||||
}
|
||||
|
||||
header li a {
|
||||
display: inline-block;
|
||||
color: #f0f6fc;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
header li a:hover {
|
||||
text-decoration: none;
|
||||
color: #b9bbbd;
|
||||
}
|
||||
|
||||
/* FOOTER */
|
||||
|
||||
.page-container {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
background-color: #161b22;
|
||||
color: #f0f6fc;
|
||||
flex-wrap: wrap;
|
||||
/* Utility classes */
|
||||
.flex {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
gap: var(--gap, 1rem);
|
||||
}
|
||||
|
||||
footer p {
|
||||
font-size: 16px;
|
||||
margin: 10px 0;
|
||||
.uppercase {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
border: 0 !important;
|
||||
clip: rect(1px, 1px, 1px, 1px) !important; /* 1 */
|
||||
-webkit-clip-path: inset(50%) !important;
|
||||
clip-path: inset(50%) !important; /* 2 */
|
||||
height: 1px !important;
|
||||
margin: -1px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
white-space: nowrap !important; /* 3 */
|
||||
}
|
||||
|
||||
/* Navigation bar */
|
||||
|
||||
.logo {
|
||||
margin: 2rem;
|
||||
width: 2rem;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
|
||||
.primary-header {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.mobile-nav-toggle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.primary-navigation {
|
||||
background: #161b22e6;
|
||||
}
|
||||
|
||||
@supports (backdrop-filter: blur(2rem)) {
|
||||
.primary-navigation {
|
||||
background: #161b2280;
|
||||
backdrop-filter: blur(2rem);
|
||||
}
|
||||
}
|
||||
|
||||
.primary-navigation a {
|
||||
color: var(--text-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
.primary-navigation a:hover {
|
||||
color: var(--hover-text-color);
|
||||
}
|
||||
|
||||
.primary-navigation a > [aria-hidden="true"] {
|
||||
font-weight: 700;
|
||||
margin-inline-end: 0.75rem;
|
||||
}
|
||||
|
||||
@media (max-width: 35em) {
|
||||
.primary-navigation {
|
||||
--gap: 3rem;
|
||||
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
inset: 0 0 0 10%;
|
||||
|
||||
flex-direction: column;
|
||||
padding: min(30vh, 10rem) 2rem;
|
||||
|
||||
transform: translateX(100%);
|
||||
transition: transform 350ms ease-out;
|
||||
}
|
||||
|
||||
.primary-navigation[data-visible="true"] {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
|
||||
.mobile-nav-toggle {
|
||||
display: block;
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
background-color: transparent;
|
||||
background-image: url("../img/icons/icon-hamburger-menu.svg");
|
||||
background-repeat: no-repeat;
|
||||
width: 3rem;
|
||||
border: 0;
|
||||
aspect-ratio: 1;
|
||||
top: 2rem;
|
||||
right: 2rem;
|
||||
}
|
||||
|
||||
.mobile-nav-toggle[aria-expanded="true"] {
|
||||
background-color: transparent;
|
||||
background-image: url("../img/icons/icon-close.svg");
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 35em) and (max-width: 55em) {
|
||||
.primary-navigation a > [aria-hidden="true"] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 35em) {
|
||||
.primary-navigation {
|
||||
--gap: clamp(1.5rem, 5vw, 3rem);
|
||||
padding-block: 16px;
|
||||
padding-inline: clamp(3rem, 8vw, 10rem);
|
||||
}
|
||||
}
|
||||
|
||||
63
static/main/img/icons/icon-close.svg
Normal file
63
static/main/img/icons/icon-close.svg
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="30"
|
||||
height="30"
|
||||
viewBox="0 0 7.9374998 7.9375"
|
||||
version="1.1"
|
||||
id="svg1771"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="icon-close.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1773"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#ffffff"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="1"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="12.400673"
|
||||
inkscape:cx="-0.36288353"
|
||||
inkscape:cy="17.539371"
|
||||
inkscape:window-width="1916"
|
||||
inkscape:window-height="1055"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="21"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs1768" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g1966"
|
||||
transform="matrix(0.75757574,0.75757576,-0.75757574,0.75757576,3.96875,-2.0445077)">
|
||||
<rect
|
||||
style="fill:#f0f6fc;fill-opacity:1;stroke-width:0.289836;stroke-miterlimit:10000;paint-order:markers stroke fill"
|
||||
id="rect234"
|
||||
width="7.9375"
|
||||
height="0.79374999"
|
||||
x="-1.7763568e-15"
|
||||
y="3.5718751"
|
||||
ry="0" />
|
||||
<rect
|
||||
style="fill:#f0f6fc;fill-opacity:1;stroke-width:0.289836;stroke-miterlimit:10000;paint-order:markers stroke fill"
|
||||
id="rect234-3"
|
||||
width="0.79374999"
|
||||
height="7.9375"
|
||||
x="3.5718751"
|
||||
y="-8.8817842e-16"
|
||||
ry="0" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
67
static/main/img/icons/icon-hamburger-menu.svg
Normal file
67
static/main/img/icons/icon-hamburger-menu.svg
Normal file
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="30"
|
||||
height="30"
|
||||
viewBox="0 0 7.9374998 7.9375"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="icon-hamburger-menu.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#ffffff"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="1"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="6.2003367"
|
||||
inkscape:cx="-20.966603"
|
||||
inkscape:cy="5.0803693"
|
||||
inkscape:window-width="1916"
|
||||
inkscape:window-height="1055"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="21"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#f0f6fc;fill-opacity:1;stroke-width:0.289836;stroke-miterlimit:10000;paint-order:markers stroke fill"
|
||||
id="rect234"
|
||||
width="7.9375"
|
||||
height="0.79374999"
|
||||
x="-1.110223e-15"
|
||||
y="1.3229166"
|
||||
ry="0" />
|
||||
<rect
|
||||
style="fill:#f0f6fc;fill-opacity:1;stroke-width:0.289836;stroke-miterlimit:10000;paint-order:markers stroke fill"
|
||||
id="rect234-3"
|
||||
width="7.9375"
|
||||
height="0.79374999"
|
||||
x="-1.110223e-15"
|
||||
y="3.5718751"
|
||||
ry="0" />
|
||||
<rect
|
||||
style="fill:#f0f6fc;fill-opacity:1;stroke-width:0.289836;stroke-miterlimit:10000;paint-order:markers stroke fill"
|
||||
id="rect234-6"
|
||||
width="7.9375"
|
||||
height="0.79374999"
|
||||
x="-1.110223e-15"
|
||||
y="5.8208332"
|
||||
ry="0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
13
static/main/js/navigation.js
Normal file
13
static/main/js/navigation.js
Normal file
@ -0,0 +1,13 @@
|
||||
const PRIMARY_NAV = document.querySelector(".primary-navigation")
|
||||
const NAV_TOGGLE = document.querySelector(".mobile-nav-toggle")
|
||||
|
||||
NAV_TOGGLE.addEventListener("click", () => {
|
||||
const visibility = PRIMARY_NAV.getAttribute("data-visible") === "false"
|
||||
if (visibility) {
|
||||
PRIMARY_NAV.setAttribute("data-visible", true)
|
||||
NAV_TOGGLE.setAttribute("aria-expanded", true)
|
||||
} else {
|
||||
PRIMARY_NAV.setAttribute("data-visible", false)
|
||||
NAV_TOGGLE.setAttribute("aria-expanded", false)
|
||||
}
|
||||
})
|
||||
@ -3,9 +3,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
|
||||
<link rel="icon" href="{% static 'main/img/logo.svg' %}" />
|
||||
<link rel="icon" href="{% static 'main/img/icons/logo.svg' %}" />
|
||||
<title>
|
||||
{% block title %}{% endblock %}
|
||||
</title>
|
||||
@ -16,26 +14,35 @@
|
||||
type="text/css"
|
||||
href="{% static 'main/css/layout.css' %}"/>
|
||||
{% block meta %}{% endblock %}
|
||||
<script src="{% static 'main/js/navigation.js' %}" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-container">
|
||||
<div class="content-wrap">
|
||||
<header>
|
||||
<header class="primary-header flex">
|
||||
<div>
|
||||
<ul>
|
||||
<a href="{% url 'home' %}">
|
||||
<img src="{% static 'main/img/icons/logo.svg' %}" alt="logo" class="logo">
|
||||
</a>
|
||||
</div>
|
||||
<button class="mobile-nav-toggle"
|
||||
aria-controls="primary-navigation"
|
||||
aria-expanded="false">
|
||||
<span class="sr-only">Menu</span>
|
||||
</button>
|
||||
<nav>
|
||||
<ul id="primary-navigation"
|
||||
class="primary-navigation flex"
|
||||
data-visible="false">
|
||||
<li>
|
||||
<a href="{% url 'home' %}">Home</a>
|
||||
<a href="{% url 'home' %}" class="bold">Home</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'instructions' %}">Karbs</a>
|
||||
<a href="{% url 'instructions' %}" class="bold">Projects</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -7,10 +7,14 @@
|
||||
href="{% static 'main/css/index.css' %}"/>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="center">
|
||||
<p>At the moment this website is under construction.</p>
|
||||
<p>
|
||||
For now you can check out <a href="{% url 'instructions' %}">KARBS</a>.
|
||||
</p>
|
||||
</div>
|
||||
<!-- <div class="center"> -->
|
||||
<!-- <img src="https://media.giphy.com/media/xTiIzJSKB4l7xTouE8/giphy.gif" -->
|
||||
<!-- alt="Hello there."> -->
|
||||
<!-- <h1> -->
|
||||
<!-- I'm <span class="highlight">Kristofers Solo</span> -->
|
||||
<!-- </h1> -->
|
||||
<!-- <h1> -->
|
||||
<!-- <span id="text-rotate">Jedi</span> -->
|
||||
<!-- </h1> -->
|
||||
<!-- </div> -->
|
||||
{% endblock %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user