Add dropdown toggles for navigation bar

- Fix styling for nav-link.active
This commit is contained in:
Sravan Balaji
2025-01-02 10:42:40 -05:00
parent 1798624bce
commit 3431132901
4 changed files with 55 additions and 27 deletions

View File

@@ -1,24 +1,37 @@
{ {
"items": [ "items": [
{ {
"text": "About", "text": "About",
"url": "/about/" "url": "/about/",
}, "sections": [
{ "Bio",
"text": "Portfolio", "Contact Me"
"url": "/portfolio/" ]
}, },
{ {
"text": "Personal", "text": "Portfolio",
"url": "/personal/" "url": "/portfolio/",
}, "sections": [
{ "Resume",
"text": "Blog", "Professional Experience",
"url": "/blog/" "Education",
}, "Research"
{ ]
"text": "Documentation", },
"url": "/documentation/" {
} "text": "Personal",
] "url": "/personal/",
} "sections": []
},
{
"text": "Blog",
"url": "/blog/",
"sections": []
},
{
"text": "Documentation",
"url": "/documentation/",
"sections": []
}
]
}

View File

@@ -2,9 +2,9 @@
{% extends "layouts/base.html" %} {% extends "layouts/base.html" %}
{% block content %} {% block content %}
<div class="container-fluid px-md-6"> <div class="container-fluid px-md-6">
{% include "partials/resume.html" %} {% include "partials/resume.html" %}
{% include "partials/professionalExperience.html" %} {% include "partials/professionalExperience.html" %}
{% include "partials/education.html" %} {% include "partials/education.html" %}
{% include "partials/research.html" %} {% include "partials/research.html" %}
</div> </div>
{% endblock %} {% endblock %}

View File

@@ -18,9 +18,20 @@
<div class="collapse navbar-collapse" id="navbarToggler"> <div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
{% for item in navigation.items %} {% for item in navigation.items %}
{% if item.sections.length > 0 %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="{{ item.text | slugify }}" role="button" data-bs-toggle="dropdown" href="{{ item.url }}"><b>{{ item.text }}</b></a>
<ul class="dropdown-menu">
{% for section in item.sections %}
<li><a class="dropdown-item" href="{{ item.url }}#{{ section | slugify }}">{{ section }}</a></li>
{% endfor %}
</ul>
</li>
{% else %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ item.url }}"><b>{{ item.text }}</b></a> <a class="nav-link" href="{{ item.url }}"><b>{{ item.text }}</b></a>
</li> </li>
{% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View File

@@ -61,6 +61,10 @@ hr {
color: var(--primary-color); color: var(--primary-color);
} }
.my-nav .nav-link.show {
color: var(--tertiary-color);
}
.my-nav .nav-link:hover { .my-nav .nav-link:hover {
color: var(--tertiary-color); color: var(--tertiary-color);
} }