From 953a3593f90377a806b05407834aa3056a85dc0e Mon Sep 17 00:00:00 2001 From: ADRN Date: Sun, 8 Dec 2024 15:16:03 +0100 Subject: [PATCH] feat(nav): soulignage de la section active dans la topbar --- sass/juice.scss | 9 +++++++-- templates/_macros.html | 21 ++++++++++++++------- templates/_nav.html | 15 +++++++++++---- templates/page.html | 5 ----- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/sass/juice.scss b/sass/juice.scss index 9770ed6..0c2afe3 100644 --- a/sass/juice.scss +++ b/sass/juice.scss @@ -77,12 +77,17 @@ header ul li { } header .nav-item { - padding: 4px 2px; + padding: 8px 6px; + margin: 0 10px; color: var(--primary-text-color); &:hover, &:active, &:focus { text-decoration: none; - border-bottom: white solid 2px; + border-bottom: white solid 1px; + } + &.active { + text-decoration: none; + border-bottom: white solid 3px; } } diff --git a/templates/_macros.html b/templates/_macros.html index 8286314..63d6c98 100644 --- a/templates/_macros.html +++ b/templates/_macros.html @@ -1,25 +1,32 @@ {% macro render_header() %} -{% set section = get_section(path="_index.md") %} +{% set root_section = get_section(path="_index.md") %} +{% set active_section = "" %} +{% if page and page.components %} + {% set active_section = page.components[0] %} +{% elif section and section.components %} + {% set active_section = section.components[0] %} +{% endif %} - - + -