Skip to content

Commit

Permalink
Responsive menu
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Feb 22, 2024
1 parent c27af85 commit 5c1afe9
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 27 deletions.
59 changes: 59 additions & 0 deletions internal/web/templates/header copy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{ define "header.html"}}

<!DOCTYPE html>
<html lang="en" data-bs-theme="{{ .Config.Color }}">
<head>
<title>Click A Habit</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--Favicon-->
<link rel="icon" type="image/x-icon" href="/fs/public/favicon.png">
{{ if eq .Config.NodePath "" }}
<!-- Font for icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<!-- Bootstrap and theme -->
<link href="https://cdn.jsdelivr.net/gh/aceberg/aceberg-bootswatch-fork@v5/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
{{ else }} <!-- Local node_modules -->
<link rel="stylesheet" href="{{ .Config.NodePath }}/node_modules/bootstrap-icons/font/bootstrap-icons.css">
<link href="{{ .Config.NodePath }}/node_modules/bootswatch/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
<script src="{{ .Config.NodePath }}/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
{{ end }}
</head>
<style>
.my-btn-lg {
width: {{ .Config.BtnWidth }};
}
</style>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-primary">
<div class="container-lg">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" href="/">
<img src="/fs/public/favicon.png" style="width: 2em"/>
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link active dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
<i class="bi bi-list"></i>
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="/planedit/new">Add Plan</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="/history/">History</a></li>
<li><a class="dropdown-item" href="/plan/">Plan</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="/config/">Config</a></li>
</ul>
</li>
</ul>
<!-- <ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active fs-3 ms-md-2" target="_blank" href="https://github.com/aceberg/ClickAHabit"><i class="bi bi-github"></i></a>
</li>
</ul> -->
</div>
</nav>
{{ end }}
50 changes: 24 additions & 26 deletions internal/web/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,31 @@
}
</style>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-primary">
<nav class="navbar navbar-expand-sm navbar-dark bg-primary">
<div class="container-lg">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" href="/">
<img src="/fs/public/favicon.png" style="width: 2em"/>
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link active dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
<i class="bi bi-list"></i>
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="/planedit/new">Add Plan</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="/history/">History</a></li>
<li><a class="dropdown-item" href="/plan/">Plan</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="/config/">Config</a></li>
</ul>
</li>
</ul>
<!-- <ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active fs-3 ms-md-2" target="_blank" href="https://github.com/aceberg/ClickAHabit"><i class="bi bi-github"></i></a>
</li>
</ul> -->
<a class="navbar-brand" href="/">
<img src="/fs/public/favicon.png" style="width: 2em"/>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample03" aria-controls="navbarsExample03" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarsExample03">
<ul class="navbar-nav me-auto mb-2 mb-sm-0">
<li class="nav-item">
<a class="nav-link active" href="/planedit/new">Add</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/plan/">Plan</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/history/">History</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/config/">Config</a>
</li>
</ul>
</div>
</div>
</nav>
{{ end }}
2 changes: 1 addition & 1 deletion internal/web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
</div>
<div class="col-md">
<button onclick='toggleLayout()' class="btn tr-button float-end" title="Toggle layout">
<button onclick='toggleLayout()' class="btn tr-button float-end d-none d-md-block" title="Toggle layout">
<i class="bi bi-layout-wtf"></i>
</button>
</div>
Expand Down

0 comments on commit 5c1afe9

Please sign in to comment.