From 628a4df0df81347c74a88e4c110066c9dc6017d1 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 11 Sep 2018 16:51:27 +0200 Subject: [PATCH] Refactor partials, layout and sass files --- assets/{markdown.scss => _markdown.scss} | 0 ...re-extension.scss => _pure-extension.scss} | 2 +- assets/{variables.scss => _variables.scss} | 6 +- assets/styles.scss | 63 +++++++++++++----- layouts/docs/baseof.html | 14 ++-- layouts/docs/index.html | 7 -- layouts/docs/list.html | 6 +- layouts/docs/single.html | 6 +- layouts/partials/book-toc.html | 1 - .../html-head.html} | 2 +- layouts/partials/book/nav-after.html | 0 .../{book-nav.html => book/nav-auto.html} | 24 ++++--- .../{book-brand.html => book/nav-brand.html} | 0 layouts/partials/book/nav-bundle.html | 5 ++ layouts/partials/book/nav.html | 5 ++ layouts/partials/book/toc.html | 1 + static/css/index.html | 21 ------ static/css/pure-start.zip | Bin 456 -> 0 bytes 18 files changed, 95 insertions(+), 68 deletions(-) rename assets/{markdown.scss => _markdown.scss} (100%) rename assets/{pure-extension.scss => _pure-extension.scss} (97%) rename assets/{variables.scss => _variables.scss} (83%) delete mode 100644 layouts/docs/index.html delete mode 100644 layouts/partials/book-toc.html rename layouts/partials/{book-html-head.html => book/html-head.html} (73%) create mode 100644 layouts/partials/book/nav-after.html rename layouts/partials/{book-nav.html => book/nav-auto.html} (71%) rename layouts/partials/{book-brand.html => book/nav-brand.html} (100%) create mode 100644 layouts/partials/book/nav-bundle.html create mode 100644 layouts/partials/book/nav.html create mode 100644 layouts/partials/book/toc.html delete mode 100644 static/css/index.html delete mode 100644 static/css/pure-start.zip diff --git a/assets/markdown.scss b/assets/_markdown.scss similarity index 100% rename from assets/markdown.scss rename to assets/_markdown.scss diff --git a/assets/pure-extension.scss b/assets/_pure-extension.scss similarity index 97% rename from assets/pure-extension.scss rename to assets/_pure-extension.scss index b4c1ab5..e540ef2 100644 --- a/assets/pure-extension.scss +++ b/assets/_pure-extension.scss @@ -50,6 +50,6 @@ html, button, input, select, textarea, .pure-g [class *= "pure-u"] { } &.active { - color: #1F37E6; + color: $color-link; } } \ No newline at end of file diff --git a/assets/variables.scss b/assets/_variables.scss similarity index 83% rename from assets/variables.scss rename to assets/_variables.scss index 4d4413e..125a29f 100644 --- a/assets/variables.scss +++ b/assets/_variables.scss @@ -25,12 +25,12 @@ $gray-800: #343a40; $gray-900: #212529; $black: #000; -// $color-link: -// $color-visited-link: - +$color-link: #1177EE; +$color-visited-link: #7823c9; $body-line-height: 1.75; $body-min-width: 25rem; $content-max-width: 64rem; +$content-min-width: $body-min-width; $nav-menu-width: 18rem; $toc-menu-width: 14rem; \ No newline at end of file diff --git a/assets/styles.scss b/assets/styles.scss index ff9dd17..e21beab 100644 --- a/assets/styles.scss +++ b/assets/styles.scss @@ -17,28 +17,20 @@ body { line-height: $body-line-height; } -.book-content { - max-width: $content-max-width; - margin: 0 auto; -} - -.book-page { - padding: 0 $size-48; +a { + text-decoration: none; + color: $color-link; } .book-brand { padding: 0 $padding-16; font-weight: 300; - - a { - color: $gray-800; - text-decoration: none; - } } +// Navigation styles .book-nav { - width: $nav-menu-width; flex-grow: 0; + width: $nav-menu-width; nav { position: fixed; @@ -50,14 +42,54 @@ body { font-size: $font-size-14; background: $gray-100; + } + + ul { + list-style: none; padding-left: $padding-16; } + + a { + display: block; + color: $gray-800; + padding: $padding-4 $padding-16; + text-transform: capitalize; + + &[href]:hover { + color: $gray-600; + } + + &.active { + color: $color-link; + } + } + + // class used for sections with bookTopSection: true + .book-nav-section { + margin-bottom: $padding-16; + > a { font-weight: 600; } + > ul { padding-left: 0; } + } } +.book-content { + max-width: $content-max-width; + min-width: $content-min-width; + margin: 0 auto; + + .book-page { + padding: $padding-16 $size-48; + } + + a:visited { + color: $color-visited-link + } +} + +// Table of Contents styles .book-toc { flex-grow: 0; width: $toc-menu-width; - font-size: $font-size-12; nav { position: fixed; @@ -67,6 +99,8 @@ body { overflow-x: hidden; overflow-y: auto; + font-size: $font-size-12; + > ul { margin: $size-48 0; padding: 0 $padding-16; @@ -80,7 +114,6 @@ body { } a { - text-decoration: none; line-height: 1.25; padding: $padding-4 0; display: block; diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 7f05ac8..9f7f942 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -1,25 +1,31 @@ - {{ partial "book-html-head" . }} - {{ .Site.Title }} + {{ partial "book/html-head" . }} + {{ block "title" . }}{{ .Site.Title }}{{ end }}
+
- {{ partial "book-nav" . }} + {{ partial "book/nav" . }}
+
{{ block "main" . }}{{ end }}
+ {{ if and (default true .Site.Params.BookShowTOC) (.Page.TableOfContents) }}
- {{ partial "book-toc" . }} + {{ partial "book/toc" . }}
+ {{ end }} +
+
\ No newline at end of file diff --git a/layouts/docs/index.html b/layouts/docs/index.html deleted file mode 100644 index 9b519ff..0000000 --- a/layouts/docs/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ define "title" }} - {{ .Title }} – {{ .Site.Title }} -{{ end }} - -{{ define "main" }} -
{{ .Content }}
-{{ end }} \ No newline at end of file diff --git a/layouts/docs/list.html b/layouts/docs/list.html index 9b519ff..130cc89 100644 --- a/layouts/docs/list.html +++ b/layouts/docs/list.html @@ -1,7 +1,7 @@ -{{ define "title" }} - {{ .Title }} – {{ .Site.Title }} +{{- define "title" -}} + {{ .Site.Title }} {{ end }} -{{ define "main" }} +{{- define "main" -}}
{{ .Content }}
{{ end }} \ No newline at end of file diff --git a/layouts/docs/single.html b/layouts/docs/single.html index 9b991dd..130cc89 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -1,3 +1,7 @@ -{{ define "main" }} +{{- define "title" -}} + {{ .Site.Title }} +{{ end }} + +{{- define "main" -}}
{{ .Content }}
{{ end }} \ No newline at end of file diff --git a/layouts/partials/book-toc.html b/layouts/partials/book-toc.html deleted file mode 100644 index 59e6b35..0000000 --- a/layouts/partials/book-toc.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Page.TableOfContents }} \ No newline at end of file diff --git a/layouts/partials/book-html-head.html b/layouts/partials/book/html-head.html similarity index 73% rename from layouts/partials/book-html-head.html rename to layouts/partials/book/html-head.html index 682423f..bf7db42 100644 --- a/layouts/partials/book-html-head.html +++ b/layouts/partials/book/html-head.html @@ -3,7 +3,7 @@ - + {{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} \ No newline at end of file diff --git a/layouts/partials/book/nav-after.html b/layouts/partials/book/nav-after.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/book-nav.html b/layouts/partials/book/nav-auto.html similarity index 71% rename from layouts/partials/book-nav.html rename to layouts/partials/book/nav-auto.html index fc89891..c54f960 100644 --- a/layouts/partials/book-nav.html +++ b/layouts/partials/book/nav-auto.html @@ -12,27 +12,29 @@ {{ end }} -