refactor navbar

This commit is contained in:
Sam 2024-08-06 11:22:35 +01:00
parent ecdc63857f
commit c014001c83
6 changed files with 81 additions and 21 deletions

View File

@ -1,10 +0,0 @@
- url: "/recipes"
name: Recipes
- url: "/data-analysis"
name: Data Analysis
- url: "https://semitamaps.com"
name: Map Printing
- url: "/blog"
name: Blog
- url: "https://git.bitlab21.com"
name: Git

View File

@ -3,5 +3,6 @@
<link rel="icon" type="image/png" sizes="48x48" href="/favicon.ico" /> <link rel="icon" type="image/png" sizes="48x48" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/css/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/css/style.css" type="text/css" media="all" />
<link rel="stylesheet" href="/css/navbar.css" type="text/css" media="all" />
<link rel="stylesheet" href="/css/syntax.css" /> <link rel="stylesheet" href="/css/syntax.css" />
</html> </html>

View File

@ -5,7 +5,7 @@
</div> </div>
<div class="navbar__right"> <div class="navbar__right">
<div class="navbar-links">{{ partial "navbarlinks.html" . }}</div> <div class="navbar-links">{{ partial "navbarlinks.html" . }}</div>
<div class="navbar-dropdown"> <!-- <div class="navbar-dropdown">
<button class="hamburger-dropbtn"> <button class="hamburger-dropbtn">
<img <img
class="hamburger" class="hamburger"
@ -16,7 +16,7 @@
<div class="navbar-dropdown-content"> <div class="navbar-dropdown-content">
{{ partial "navbarlinks.html" . }} {{ partial "navbarlinks.html" . }}
</div> </div>
</div> </div> -->
</div> </div>
</nav> </nav>
</header> </header>

View File

@ -1,3 +1,10 @@
{{ range $.Site.Data.navbarlinks }} <ul>
<ul><a href="{{ .url }}">{{ .name }}</a></ul> <li><a href="/blog">Blog</a></li>
{{ end }} <li class="navbar_link_dropdown">
<a href="#" class="dropbtn">Projects</a>
<div class="navbar-link-dropdown-content">
<a href="/data-analysis">Data Analysis</a>
<a href="https://semitamaps.com">Map Printing</a>
</div>
</li>
</ul>

66
static/css/navbar.css Normal file
View File

@ -0,0 +1,66 @@
/* Navbar */
.navbar {
background-color: var(--navbar-background-color);
display: flex;
justify-content: space-between;
position: sticky;
top: 0;
height: 50px;
width: 100%;
z-index: 999;
}
.navbar a {
color: var(--navbar-text-color);
padding: 10px;
margin: 5px;
text-decoration: none;
transition: background-color 0.3s ease;
border-radius: var(--radius);
}
.navbar a:hover {
padding: 10px;
background-color: var(--navbar-hover);
border-radius: var(--radius);
color: var(--text-color);
}
.navbar__left a {
text-decoration: none !important;
color: var(--text-color) !important;
font-size: 22px;
}
.navbar__left {
display: flex;
align-items: center;
}
.navbar-links ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
.navbar-links ul li {
float: left;
}
.navbar-links ul li a {
display: inline-block;
}
.navbar-link-dropdown-content {
display: none;
position: absolute;
flex-direction: column;
right: 20px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
background-color: var(--navbar-background-color);
}
.navbar_link_dropdown:hover .navbar-link-dropdown-content {
display: flex;
}

View File

@ -245,8 +245,7 @@ time {
background-color: var(--summary-container-hover-bg); background-color: var(--summary-container-hover-bg);
} }
/* Navbar */ /* .navbar {
.navbar {
background-color: var(--navbar-background-color); background-color: var(--navbar-background-color);
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -348,7 +347,6 @@ time {
border-radius: var(--radius); border-radius: var(--radius);
} }
/* Links inside the dropdown */
.navbar-dropdown-content a { .navbar-dropdown-content a {
float: none; float: none;
color: var(--text-color); color: var(--text-color);
@ -358,17 +356,15 @@ time {
text-align: left; text-align: left;
} }
/* Add a grey background color to dropdown links on hover */
.navbar-dropdown-content a:hover { .navbar-dropdown-content a:hover {
padding: 12px 16px; padding: 12px 16px;
background-color: var(--navbar-hover); background-color: var(--navbar-hover);
} }
/* Show the dropdown menu on hover */
.navbar-dropdown:hover .navbar-dropdown-content { .navbar-dropdown:hover .navbar-dropdown-content {
display: block; display: block;
} }
} } */
/* Charts */ /* Charts */
.chart-flex-container { .chart-flex-container {