Skip to content

Commit

Permalink
active tab color (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgauci committed Dec 6, 2022
1 parent f069329 commit 8bafcaa
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ disableKinds = ["taxonomy", "term"]
weight = 2

[[menu.main]]
name = 'Quick Demo'
name = 'Demo'
url = '/overview/demo'
parent = 'overview'
weight = 3
Expand Down
12 changes: 6 additions & 6 deletions themes/haystack/assets/sass/components/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
}

// Current page link
li.active > a {
color: var(--color-yellow);
li.active > a, a.active {
color: var(--color-yellow) !important;
}

ul {
Expand Down Expand Up @@ -98,7 +98,7 @@
display: flex;

&:hover {
> a {
> a:not(.active) {
color: var(--color-dark-blue);
}
}
Expand Down Expand Up @@ -172,15 +172,15 @@
// Dark
.header-dark .desktop-nav {

li > a {
li > a:not(.active) {
color: var(--color-light-grey);

&:hover {
color: var(--color-white);
}
}

li.active > a {
li.active > a, a.active {
color: var(--color-yellow);
}

Expand All @@ -195,7 +195,7 @@

li.dropdown-menu {
&:hover {
> a {
> a:not(.active) {
color: var(--color-white);
}
}
Expand Down
2 changes: 1 addition & 1 deletion themes/haystack/layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
>
</li>
<li>
<a aria-label="Hugging Face" href="/">Open NLP Meetup</a>
<a aria-label="Join the Open NLP Meetup" href="https://www.meetup.com/open-nlp-meetup/">Open NLP Meetup</a>
</li>
</ul>

Expand Down
4 changes: 2 additions & 2 deletions themes/haystack/layouts/partials/navigation-mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<ul class="sub-menu" role="list">
{{ range .Children }}
<li
class="{{ if (eq $currentPage.RelPermalink .URL) }}
class="{{ if (in $currentPage.RelPermalink .URL) }}
active
{{ end }}"
>
Expand All @@ -40,7 +40,7 @@
{{ else }}
{{/* If no children, add a link */}}
<li>
<a href="{{ .URL }}" {{ if strings.HasPrefix .URL "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Name }}</a>
<a href="{{ .URL }}" class="{{ if (in $currentPage.RelPermalink .URL) }}active{{ end }}" {{ if strings.HasPrefix .URL "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Name }}</a>
</li>
{{ end }}
{{ end }}
Expand Down
30 changes: 27 additions & 3 deletions themes/haystack/layouts/partials/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,34 @@
{{/* If nav item has children, add a dropdown menu */}}
{{ if .HasChildren }}
<li class="dropdown-menu">
<a href="#" class="dropdown-button">
{{ $childSlice := slice }}
{{ range .Children }}
{{ $childSlice = $childSlice | append .Name }}
{{ end }}

<a
href="#"
class="dropdown-button {{ if in $childSlice $currentPage.Name }}
active
{{ end }}"
>
{{ .Name }}
</a>

<ul class="sub-menu" role="list">
{{ range .Children }}
<li
class="{{ if (in $currentPage.RelPermalink .URL) }}
active
{{ end }}"
>
<a class="btn arrow-link" href="{{ .URL }}" {{ if strings.HasPrefix .URL "http" }} target="_blank" rel="noopener"{{ end }}>
<a
class="btn arrow-link"
href="{{ .URL }}"
{{ if strings.HasPrefix .URL "http" }}
target="_blank" rel="noopener"
{{ end }}
>
<div class="button-wrapper">
<svg
xmlns="http:https://www.w3.org/2000/svg"
Expand Down Expand Up @@ -46,7 +63,14 @@
{{ else }}
{{/* If no children, add a link */}}
<li>
<a href="{{ .URL }}" {{ if strings.HasPrefix .URL "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Name }}</a>
<a
href="{{ .URL }}"
class="{{ if (in $currentPage.RelPermalink .URL) }}active{{ end }}"
{{ if strings.HasPrefix .URL "http" }}
target="_blank" rel="noopener"
{{ end }}
>{{ .Name }}</a
>
</li>
{{ end }}
{{ end }}
Expand Down

1 comment on commit 8bafcaa

@vercel
Copy link

@vercel vercel bot commented on 8bafcaa Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.