diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2018-09-11 16:51:27 +0200 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2018-09-11 16:51:27 +0200 |
commit | 628a4df0df81347c74a88e4c110066c9dc6017d1 (patch) | |
tree | 474ba777084cf5593c79330b71539f2a4fa7733f | |
parent | 43974d0908a341ef8dd5d100a63563784fdbf70c (diff) |
Refactor partials, layout and sass files
-rw-r--r-- | assets/_markdown.scss (renamed from assets/markdown.scss) | 0 | ||||
-rw-r--r-- | assets/_pure-extension.scss (renamed from assets/pure-extension.scss) | 2 | ||||
-rw-r--r-- | assets/_variables.scss (renamed from assets/variables.scss) | 6 | ||||
-rw-r--r-- | assets/styles.scss | 63 | ||||
-rw-r--r-- | layouts/docs/baseof.html | 14 | ||||
-rw-r--r-- | layouts/docs/index.html | 7 | ||||
-rw-r--r-- | layouts/docs/list.html | 6 | ||||
-rw-r--r-- | layouts/docs/single.html | 6 | ||||
-rw-r--r-- | layouts/partials/book-toc.html | 1 | ||||
-rw-r--r-- | layouts/partials/book/html-head.html (renamed from layouts/partials/book-html-head.html) | 2 | ||||
-rw-r--r-- | layouts/partials/book/nav-after.html | 0 | ||||
-rw-r--r-- | layouts/partials/book/nav-auto.html (renamed from layouts/partials/book-nav.html) | 24 | ||||
-rw-r--r-- | layouts/partials/book/nav-brand.html (renamed from layouts/partials/book-brand.html) | 0 | ||||
-rw-r--r-- | layouts/partials/book/nav-bundle.html | 5 | ||||
-rw-r--r-- | layouts/partials/book/nav.html | 5 | ||||
-rw-r--r-- | layouts/partials/book/toc.html | 1 | ||||
-rw-r--r-- | static/css/index.html | 21 | ||||
-rw-r--r-- | static/css/pure-start.zip | bin | 456 -> 0 bytes |
18 files changed, 95 insertions, 68 deletions
diff --git a/assets/markdown.scss b/assets/_markdown.scss index d2a33ff..d2a33ff 100644 --- a/assets/markdown.scss +++ b/assets/_markdown.scss diff --git a/assets/pure-extension.scss b/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 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 @@ <!DOCTYPE html> <html> <head> - {{ partial "book-html-head" . }} - <title>{{ .Site.Title }}</title> + {{ partial "book/html-head" . }} + <title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title> </head> <body> <div class="pure-g"> + <div class="pure-u book-nav"> - {{ partial "book-nav" . }} + {{ partial "book/nav" . }} </div> <div class="pure-u book-content"> <div class="pure-g"> + <div class="pure-u book-page markdown"> {{ block "main" . }}{{ end }} </div> + {{ if and (default true .Site.Params.BookShowTOC) (.Page.TableOfContents) }} <div class="pure-u book-toc"> - {{ partial "book-toc" . }} + {{ partial "book/toc" . }} </div> + {{ end }} + </div> </div> + </div> </body> </html>
\ 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" }} - <div>{{ .Content }}</div> -{{ 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" -}} <div>{{ .Content }}</div> {{ 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" -}} <div>{{ .Content }}</div> {{ 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 index 682423f..bf7db42 100644 --- a/layouts/partials/book-html-head.html +++ b/layouts/partials/book/html-head.html @@ -3,7 +3,7 @@ <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,600" rel="stylesheet"> <link href="/css/pure-min.css" rel="stylesheet"> -<link href="/css/grids-responsive-min.css" rel="stylesheet"> +<!-- <link href="/css/grids-responsive-min.css" rel="stylesheet"> --> {{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} <link rel="stylesheet" href="{{ $styles.Permalink }}">
\ 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 --- /dev/null +++ b/layouts/partials/book/nav-after.html diff --git a/layouts/partials/book-nav.html b/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 }} -<nav role="navigation" class="pure-menu"> - {{ partial "book-brand" . }} +<nav role="navigation"> + {{ partial "book/nav-brand" . }} - <ul class="pure-menu-list pure-menu-root"> + <ul> {{ range .Scratch.Get "BookSections" }} {{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }} {{ end }} </ul> + + {{ partial "book/nav-after" . }} </nav> <!-- Single section of menu (recursive) --> {{ define "book-section" }} - <li class="pure-menu-item"> + <li {{ if .Section.Params.booktopsection }}class="book-nav-section"{{ end }}> {{ template "book-heading" .Section }} - <ul class="pure-menu-list"> + <ul> {{ range .Section.Sections }} {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }} {{ end }} {{ range .Section.Pages }} - <li class="pure-menu-item"> - <a href="{{ .RelPermalink }}" class="pure-menu-link {{ if eq $.CurrentPage .Permalink }}active{{ end }}"> + <li> + <a href="{{ .RelPermalink }}" class="{{ if eq $.CurrentPage .Permalink }}active{{ end }}"> {{ default .Title (.File | humanize | title) }} </a> </li> @@ -49,13 +51,13 @@ {{ $title := default .Title $title }} {{ if .Content }} -<a href="{{ .RelPermalink }}" class="pure-menu-link {{ if .IsSection }}section{{ end }}"> - {{- $title -}} +<a href="{{ .RelPermalink }}"> + {{- $title -}} </a> {{ else }} -<span class="pure-menu-heading {{ if .IsSection }}section{{ end }}"> +<a> {{- $title -}} -</span> +</a> {{ end }} {{ end }} diff --git a/layouts/partials/book-brand.html b/layouts/partials/book/nav-brand.html index 5a2c9cb..5a2c9cb 100644 --- a/layouts/partials/book-brand.html +++ b/layouts/partials/book/nav-brand.html diff --git a/layouts/partials/book/nav-bundle.html b/layouts/partials/book/nav-bundle.html new file mode 100644 index 0000000..46665ad --- /dev/null +++ b/layouts/partials/book/nav-bundle.html @@ -0,0 +1,5 @@ +<nav role="navigation"> + {{ partial "book/nav-brand" . }} + {{ with .Site.GetPage .Site.Params.BookMenuBundle }}{{ .Content }}{{ end }} + {{ partial "book/nav-after" . }} +</nav> diff --git a/layouts/partials/book/nav.html b/layouts/partials/book/nav.html new file mode 100644 index 0000000..cc24df7 --- /dev/null +++ b/layouts/partials/book/nav.html @@ -0,0 +1,5 @@ +{{ if .Site.Params.BookMenuBundle }} + {{ partial "book/nav-bundle" . }} +{{ else }} + {{ partial "book/nav-auto" . }} +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/book/toc.html b/layouts/partials/book/toc.html new file mode 100644 index 0000000..aca3785 --- /dev/null +++ b/layouts/partials/book/toc.html @@ -0,0 +1 @@ +{{ .Page.TableOfContents }}
\ No newline at end of file diff --git a/static/css/index.html b/static/css/index.html deleted file mode 100644 index 05c6126..0000000 --- a/static/css/index.html +++ /dev/null @@ -1,21 +0,0 @@ -<!doctype html> -<html> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Your page title</title> - - <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css"> <!--[if lte IE 8]> - <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-old-ie-min.css"> - <![endif]--> - <!--[if gt IE 8]><!--> - <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-min.css"> - <!--<![endif]--></head> - -<body> - <!-- - Your HTML goes here. Visit purecss.io/layouts/ for some sample HTML code. - --> -</body> -</html> diff --git a/static/css/pure-start.zip b/static/css/pure-start.zip Binary files differdeleted file mode 100644 index db609b4..0000000 --- a/static/css/pure-start.zip +++ /dev/null |