mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
14 hours ago a9294ae4c2e10b2c0d313dcfd6f0f3d520452f57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{{- /*
  Returns the classes for each navigation element: the value from
  `[params.ananke.navigation.classes]`, or the theme default.
 
  @return map  Element name -> class string.
*/ -}}
{{- $rtl := compare.Eq site.Language.Direction "rtl" -}}
{{- $background := site.Params.background_color_class | compare.Default "bg-black" -}}
{{- $defaults := collections.Dictionary
  "nav" "pv3 ph3 ph4-ns"
  "inner" "flex flex-wrap items-center justify-between center"
  "brand" "f3 fw2 hover-white white-90 dib no-underline"
  "toggle" "f5 white-90 hover-white"
  "group" "flex-l items-center"
  "panel" "flex-l items-center"
  "menu" (compare.Conditional $rtl "pr0 ml3" "pl0 mr3")
  "item" (printf "list f5 f4-ns fw4 dib %s" (compare.Conditional $rtl "pl3" "pr3"))
  "link" "hover-white white-90 no-underline"
  "submenu_toggle" "hover-white white-90"
  "submenu" (printf "list ma0 pv2 ph0 br2 ba b--white-20 %s" $background)
  "submenu_link" "db pv2 ph3 f5 white-90 hover-white hover-bg-white-10 no-underline"
-}}
{{- $configured := collections.Dictionary -}}
{{- with site.Params.ananke.navigation -}}
  {{- with .classes -}}{{- $configured = . -}}{{- end -}}
{{- end -}}
{{- $classes := collections.Dictionary -}}
{{- range $key, $default := $defaults -}}
  {{- $value := collections.Index $configured $key | compare.Default $default -}}
  {{- $classes = collections.Merge $classes (collections.Dictionary $key $value) -}}
{{- end -}}
{{- return $classes -}}