diff --git a/assets/sass/_theme/_utils.sass b/assets/sass/_theme/_utils.sass index 46ecb5d08dda704ad92841633e3cbf97d5c6b01d..7d3258a8db7df162b58528729fe5f186d0afc890 100644 --- a/assets/sass/_theme/_utils.sass +++ b/assets/sass/_theme/_utils.sass @@ -39,13 +39,16 @@ @function half($size) @return calc(#{$size} / 2) -@mixin link($color: $link-color) +@mixin link($color: $link-color, $unhover_decorated: true) color: $color - text-decoration-color: rgba($color, 0.3) text-decoration-line: underline text-decoration-thickness: 1px text-underline-offset: $link-underline-offset transition: text-decoration-color .3s ease + @if $unhover_decorated + text-decoration-color: rgba($color, 0.3) + @else + text-decoration-color: transparent &:hover text-decoration-color: rgba($color, 1) text-decoration-thickness: 1px diff --git a/assets/sass/_theme/design-system/header.sass b/assets/sass/_theme/design-system/header.sass index eca47feb73dbd2e3589941d72611dc7ee6c9361c..a1156dea1f534a252742bc4efb847a5588e68032 100644 --- a/assets/sass/_theme/design-system/header.sass +++ b/assets/sass/_theme/design-system/header.sass @@ -24,8 +24,6 @@ header#document-header a:focus, a:active color: inherit - a:not(:hover) - text-decoration-color: transparent span color: $header-sticky-color @if $header-sticky-invert-logo diff --git a/assets/sass/_theme/design-system/nav.sass b/assets/sass/_theme/design-system/nav.sass index 44755c444ca2fab33f42e8f4df9cea512c24722e..0b331bb3dbb25341bace3edb660832f9488c302d 100644 --- a/assets/sass/_theme/design-system/nav.sass +++ b/assets/sass/_theme/design-system/nav.sass @@ -17,7 +17,7 @@ a, a:focus, a:active - @include link($header-color) + @include link($header-color, false) span color: $header-color ul @@ -30,8 +30,8 @@ cursor: pointer transition: text-decoration 0.15s display: block - &:not(:hover) - text-decoration-color: transparent + // &:not(:hover) + // text-decoration-color: transparent &[aria-expanded] @include icon(caret, after) margin-left: px2rem(5) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a9459f1b2ec1d509dac4b959f384955c09a06d6f..8dd9d91db41e715f57aca9ba2af5741c1cacc9dc 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -15,7 +15,7 @@ {{ $body_class = printf "%s %s" $body_class $pageclass }} <body class="{{ $body_class }}"> {{- partial "header/accessibility.html" -}} - {{- partial "header/header.html" -}} + {{- partial "header/header.html" . -}} <main{{ if .Params.blocks }} class="page-with-blocks"{{ end }} id="main" tabindex="-1"> {{- block "main" . }}{{- end }} {{- partial "hooks/before-main-end" . -}} diff --git a/layouts/partials/commons/menu.html b/layouts/partials/commons/menu.html index 34174849906e043685fb9b70e9f06fa0a4bc4228..6debde891764e1fef1b2570c6e540c9f3b683e78 100644 --- a/layouts/partials/commons/menu.html +++ b/layouts/partials/commons/menu.html @@ -1,5 +1,6 @@ {{- $kind := .kind -}} {{ $items := .items }} +{{ $context := .context }} {{ if $kind }} {{ $items = partial "GetMenu" $kind }} {{ end }} @@ -19,6 +20,9 @@ {{- $attr := "" -}} {{- $attr_title := "" -}} {{- $hasDropdown := false -}} + {{ if eq $context.RelPermalink .target }} + {{ $linkClass = "active" }} + {{ end }} {{- if gt (len .children) 0 -}} {{- $itemClass = printf "%shas-children" $itemClass -}} {{- end -}} @@ -47,6 +51,7 @@ (dict "items" .children "level" $nextLevel + "context" $context ) -}} {{- end -}} {{- if $hasDropdown -}} diff --git a/layouts/partials/header/header.html b/layouts/partials/header/header.html index c047b7019fe3ac588a3fb0c3c07a3dd829209c30..cb886f37287a56fbd65bc672ab0f84793fef4a4b 100644 --- a/layouts/partials/header/header.html +++ b/layouts/partials/header/header.html @@ -1,3 +1,4 @@ +{{ $context := . }} <header id="document-header"> <nav aria-label="{{ i18n "commons.menu.main" }}"> <div class="container"> @@ -10,6 +11,7 @@ "kind" "primary" "dropdown" true "level" 1 + "context" . ) }} </div> </div>