Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active tab color #62

Merged
merged 1 commit into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
active tab color
  • Loading branch information
carlosgauci committed Dec 3, 2022
commit 42aef9769f136cb7b27068e743dbc5538b4676de
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="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