Skip to content

Commit

Permalink
feat: add the hb.docs.navs_active_style parameter
Browse files Browse the repository at this point in the history
Available options: empty string or `bordered`.

Closes #835
  • Loading branch information
razonyang committed Oct 12, 2024
1 parent ff97b23 commit 06b7af1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions assets/hb/modules/docs/scss/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,37 @@
margin-top: 0.25rem;
padding: 0.25rem 0.5rem;
text-decoration: none;
}

.hb-docs-nav-heading {
&:hover,
&.active {
background: var(--#{$prefix}primary-bg-subtle);
}
}

.hb-docs-nav-link {
position: relative;

&:hover,
&.active {
@if ($hb-docs-navs-active-style == '') {
background: var(--#{$prefix}primary-bg-subtle);
}

@if ($hb-docs-navs-active-style == 'bordered') {
&::before {
content: "";
position: absolute;
left: 0;
margin-left: -.325rem;
border-left: 2px solid var(--#{$prefix}primary);
height: 1.25rem;
}
}
}
}

.hb-docs-nav-links {
> .hb-docs-nav-links-span-all {
.hb-docs-nav-link {
Expand Down
1 change: 1 addition & 0 deletions assets/hb/modules/docs/scss/variables.tmpl.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$hb-docs-navs-sticky-scroll: {{ default true site.Params.hb.docs.navs_sticky_scroll }};
$hb-docs-navs-active-style: '{{ default "" site.Params.hb.docs.navs_active_style }}';
1 change: 1 addition & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cache_key = "page.Type"
date_format = ":date_long"
navs_reduce_font_size = false
navs_sticky_scroll = true
navs_active_style = "" # empty or bordered.

# Takes the full width by default.
[params.hb.full_width_types.docs]
Expand Down

0 comments on commit 06b7af1

Please sign in to comment.