1
0
Эх сурвалжийг харах

feat(docs): Improve docs nav menu: correct ordering & expand sections

Michael Bromley 7 жил өмнө
parent
commit
7b5dcbf829

+ 0 - 0
docs/readme.md → docs/README.md


+ 10 - 0
docs/assets/styles/_menu.scss

@@ -0,0 +1,10 @@
+.book-menu {
+    .section > ul {
+        max-height: 0px;
+        overflow: hidden;
+
+        &.expanded {
+            max-height: initial;
+        }
+    }
+}

+ 12 - 0
docs/assets/styles/_shortcodes.scss

@@ -0,0 +1,12 @@
+@import "variables";
+
+.alert {
+    border: 1px solid;
+    border-radius: 2px;
+    padding: 0 12px;
+
+    &.primary { border-color: $color-default; background: transparentize($color-default, 0.9); }
+    &.danger { border-color: $color-danger; background: transparentize($color-danger, 0.9); }
+    &.warning { border-color: $color-warning; background: transparentize($color-warning, 0.9); }
+    &.success { border-color: $color-success; background: transparentize($color-success, 0.9); }
+}

+ 4 - 0
docs/assets/styles/_variables.scss

@@ -24,6 +24,10 @@ $black: #000;
 $color-link: #087298;
 $color-link: #087298;
 $color-visited-link: #1e6198;
 $color-visited-link: #1e6198;
 $brand-color: #13b7f3;
 $brand-color: #13b7f3;
+$color-default: #0079B8;
+$color-danger: #e12200;
+$color-warning: #FF8400;
+$color-success: #2F8400;
 
 
 $body-background: white;
 $body-background: white;
 $body-font-color: $gray-800;
 $body-font-color: $gray-800;

+ 2 - 0
docs/assets/styles/main.scss

@@ -3,6 +3,8 @@
 @import "utils";
 @import "utils";
 @import "landing-page";
 @import "landing-page";
 @import "top-bar";
 @import "top-bar";
+@import "menu";
+@import "shortcodes";
 
 
 html {
 html {
     font-size: $font-size-base;
     font-size: $font-size-base;

+ 1 - 2
docs/config.toml

@@ -2,12 +2,11 @@ baseURL = "http://example.org/"
 languageCode = "en-us"
 languageCode = "en-us"
 title = "Vendure Documenation"
 title = "Vendure Documenation"
 pygmentsCodeFences = true
 pygmentsCodeFences = true
-pygmentsStyle = "friendly"
+pygmentsStyle = "monokai"
 disableKinds = [
 disableKinds = [
   "taxonomy",
   "taxonomy",
   "taxonomyTerm"
   "taxonomyTerm"
 ]
 ]
 [params]
 [params]
-    BookMenuBundle = "/menu"
     BookSection = "docs"
     BookSection = "docs"
 
 

+ 0 - 17
docs/content/menu/index.md

@@ -1,17 +0,0 @@
----
-headless: true
----
-
-* [Getting started](/docs/getting-started)
-* [Configuration](/docs/configuration)
-  * [assetOptions](/docs/config-asset-options)
-  * [authOptions](/docs/config-auth-options)
-  * [customFields](/docs/config-custom-fields)
-  * [emailOptions](/docs/config-email-options)
-  * [orderProcessOptions](/docs/config-order-process-options)
-  * [paymentOptions](/docs/config-payment-options)
-  * [promotionOptions](/docs/config-promotion-options)
-  * [shippingOptions](/docs/config-shipping-options)
-  * [taxOptions](/docs/config-tax-options)
-* [Plugins](/docs/plugins)
-* *Importing data*

+ 21 - 19
docs/layouts/partials/docs/menu-filetree.html

@@ -1,28 +1,30 @@
 <!-- Put configured sections list to .Scratch -->
 <!-- Put configured sections list to .Scratch -->
-{{ template "book-get-root-section" . }} 
+{{ template "book-get-root-section" . }}
 
 
 {{- range .Scratch.Get "BookSections" -}}
 {{- range .Scratch.Get "BookSections" -}}
   {{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
   {{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
 {{- end -}}
 {{- end -}}
 
 
 {{ define "book-section" }} <!-- Single section of menu (recursive) -->
 {{ define "book-section" }} <!-- Single section of menu (recursive) -->
-  <ul>
-    {{ range .Section.Sections }}
-    <li {{- if .Params.bookflatsection}} class="flat-section" {{ end }}>
-      {{- if .Content -}}
-        {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
-      {{- else -}}
-        {{- template "title" . -}}
-      {{- end -}}
-
-      {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }}
-    </li>
-    {{ end }}
-
-    {{ range .Section.Pages }}
-    <li>
-      {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
-    </li>
+<ul {{ if .Expanded }}class="expanded"{{ end }}>
+    {{ $list := .Section.Sections }}
+    {{ $list = $list | append .Section.Pages }}
+    {{ range sort $list "Weight" }}
+        {{ if eq .Kind "section" }}
+            <li class="section">
+                {{- if .Content -}}
+                  {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
+                {{- else -}}
+                  {{- template "title" . -}}
+                {{- end -}}
+                {{ $expanded := in $.CurrentPage .Permalink }}
+                {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage "Expanded" $expanded) }}
+            </li>
+        {{ else }}
+            <li>
+                {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
+            </li>
+        {{ end }}
     {{ end }}
     {{ end }}
   </ul>
   </ul>
 {{ end }}
 {{ end }}
@@ -44,4 +46,4 @@
     {{ $bookSections := where .Site.Sections "Section" $bookSection }}
     {{ $bookSections := where .Site.Sections "Section" $bookSection }}
     {{ .Scratch.Set "BookSections" $bookSections }}
     {{ .Scratch.Set "BookSections" $bookSections }}
   {{ end }}
   {{ end }}
-{{ end }}
+{{ end }}