Fix navbar on mobile

This commit is contained in:
Edward Betts 2024-01-02 18:56:13 +00:00
parent 31d5da22ac
commit 2b3e4f8d72
3 changed files with 8 additions and 3 deletions

View file

@ -18,5 +18,6 @@
{% block nav %}{{ navbar() }}{% endblock %}
{% block content %}{% endblock %}
{% block scripts %}{% endblock %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>

View file

@ -235,6 +235,6 @@
</div>
{% endfor %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>

View file

@ -8,7 +8,8 @@
{"endpoint": "gaps_page", "label": "Gaps" },
] %}
<nav class="navbar navbar-expand-lg bg-success" data-bs-theme="dark">
<nav class="navbar navbar-expand-md bg-success" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand" href="{{ url_for("index") }}">Agenda</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
@ -17,8 +18,11 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
{% for page in pages %}
{% set is_active = request.endpoint == page.endpoint %}
<li class="nav-item">
<a class="nav-link{% if request.endpoint == page.endpoint %} border border-white border-2 active{% endif %}" href="{{ url_for(page.endpoint) }}">{{ page.label }}</a>
<a class="nav-link{% if is_active %} border border-white border-2 active{% endif %}" {% if is_active %} aria-current="page"{% endif %} href="{{ url_for(page.endpoint) }}">
{{ page.label }}
</a>
</li>
{% endfor %}
</ul>