Skip to content

Commit

Permalink
💄 Refactored stack layout usage
Browse files Browse the repository at this point in the history
  • Loading branch information
toby3d committed Dec 29, 2023
1 parent 1cb9fa0 commit 9b4664a
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 117 deletions.
27 changes: 20 additions & 7 deletions assets/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
padding: 0;
}

body {
display: flex;
min-height: 100vh;
flex-direction: column;
}

main {
flex: 1 0 auto;
}

h1,
h2,
h3,
Expand All @@ -53,19 +63,19 @@ h4 {
font-size: var(--s0);
}

h1 > .header__sub-header {
h1>.header__sub-header {
font-size: calc(var(--s3) / 2);
}

h2 > .header__sub-header {
h2>.header__sub-header {
font-size: calc(var(--s2) / 2);
}

h3 > .header__sub-header {
h3>.header__sub-header {
font-size: calc(var(--s1) / 2);
}

h4 > .header__sub-header {
h4>.header__sub-header {
font-size: calc(var(--s0) / 2);
}

Expand Down Expand Up @@ -158,8 +168,10 @@ button[disabled]:focus,

a:focus,
.link:focus {
outline: 3px solid Highlight; /* NOTE(toby3d): non-webkit browsers */
outline: 3px solid -webkit-focus-ring-color; /* NOTE(toby3d): webkit browsers */
outline: 3px solid Highlight;
/* NOTE(toby3d): non-webkit browsers */
outline: 3px solid -webkit-focus-ring-color;
/* NOTE(toby3d): webkit browsers */
}

blockquote {
Expand All @@ -172,7 +184,8 @@ blockquote * {
color: inherit;
}

strong, b {
strong,
b {
font-variation-settings: 'wght' 600;
font-weight: 600;
line-height: var(--line-height-small);
Expand Down
20 changes: 13 additions & 7 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<!DOCTYPE html>
<html class="page" lang="{{ .Page.Lang }}" dir="ltr">
<head>
{{ partial "head" . }}
</head>
<body class="[ page__body ][ body stack stack_split-after_4 {{ if eq .Kind "404" }} cover cover_min-height_100vh {{ end }} ]">
<html class="page"
lang="{{ .Page.Lang }}"
dir="ltr">

<head>{{ partial "head" . }}</head>

<body class="[ page__body ][ body {{ if eq .Kind "404" }} cover cover_min-height_100vh {{ end }} ]">
{{ partial "skip-links" . }}

{{ block "header" . }}
{{ partial "navigation" . }}
{{ partial "navigation" . }}
{{ end }}

{{ block "main" . }}{{ end }}

{{ block "footer" . }}
{{ partial "footer" . }}
{{ partial "footer" . }}
{{ end }}

{{ partial "scripts" . }}
</body>
</html>
10 changes: 4 additions & 6 deletions layouts/_default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
{{ end }}

{{ define "main" }}
<main class="[ body__main ][ center ][ width:100% ]"
id="main"
style="padding:0;">
<main class="[ body__main box ][ center ][ width:100% ]"
id="main">

{{ $blog := .Site.GetPage "blog" }}
<h2>
{{ $blog.Title }}
</h2>
<h2>{{ $blog.Title }}</h2>
<ul class="[ stack ][ list-style:none ]">
{{ range first 5 $blog.Pages }}
{{ .Render "summary" }}
Expand Down
40 changes: 21 additions & 19 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{{ define "header" }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ end }}

{{ define "main" }}
<main class="[ body__main ][ sidebar sidebar_side_left ]" id="main">
<div>
<aside class="center" style="max-width:13rem;">
<section>
<header class="stack stack_recursive">
<h2>{{ i18n "toc" }}</h2>
</header>
{{ .TableOfContents }}
</section>
</aside>
{{ with .Content }}
<article class="center center_max_x1.5 stack stack_inherit">
{{ . }}
</article>
{{ end }}
</div>
</main>
<main class="[ body__main box ][ sidebar sidebar_side_left ]"
id="main">
<div>
<aside class="center"
style="max-width:13rem;">
<section>
<header class="stack stack_recursive">
<h2>{{ i18n "toc" }}</h2>
</header>
{{ .TableOfContents }}
</section>
</aside>
{{ with .Content }}
<article class="center center_max_x1.5 stack stack_inherit">
{{ . }}
</article>
{{ end }}
</div>
</main>
{{ end }}
28 changes: 15 additions & 13 deletions layouts/_default/terms.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{{ define "header" }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ end }}

{{ define "main" }}
<main class="center center_padding_gutters stack" id="main">
<article class="stack">
{{ with .Content }}{{ . }}{{ end }}
<ul class="stack">
{{ range .Data.Pages }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</article>
</main>
{{ partial "pagination" . }}
<main class="[ body__main box ][ stack center center_padding_gutters ]"
id="main">

<article class="stack">
{{ with .Content }}{{ . }}{{ end }}
<ul class="stack">
{{ range .Data.Pages }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</article>
</main>
{{ partial "pagination" . }}
{{ end }}
56 changes: 34 additions & 22 deletions layouts/blog/single.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
{{ define "header" }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ $authors := slice }}
{{ range .Params.authors }}
{{ partial "navigation" . }}
<header class="[ body__header box ][ stack ][ background-color_primary margin-top:0 ]"
id="header">

<div class="center center_max_x1.5">
<h1>{{ .Title }}</h1>

{{ $authors := slice }}
{{ range .Params.authors }}
{{ $authors = $authors | append ($.Site.GetPage (print "authors/" .)) }}
{{ end }}
<div class="[ center center_max_x1.5 ][ width:100% ]">
<h3>
{{ i18n "by" | title }}
{{ end }}
<h2>
{{ i18n "by" }}
{{ range $index, $author := $authors }}
{{- if gt $index 0 }},{{ end }}
<a href="{{ $author.Permalink }}" title="{{ $author.LinkTitle }}">
{{- $author.Params.displayName -}}
</a>
{{- if gt $index 0 }},{{ end }}
<a href="{{ $author.Permalink }}"
title="{{ $author.LinkTitle }}">
{{- $author.Params.displayName -}}
</a>
{{- end }}
</h3>
</h2>
<small>
{{ i18n "published" }}
<time>{{ .PublishDate.Format "January 2, 2006" }}</time>
</small>
</div>
</header>
{{ end }}

{{ define "main" }}
<main class="[ body__main ][ center center_max_x1.5 ][ width:100% ]" id="main">
{{ with .Content }}
<article class="stack stack_recursive">
{{ . }}
</article>
{{ end }}
</main>
<main class="[ body__main box ][ center center_max_x1.5 ][ width:100% ]"
id="main">

{{ with .Content }}
<article class="stack stack_recursive">
{{ . }}
</article>
{{ end }}
</main>
{{ end }}

{{ define "footer" }}
<footer id="footer" class="[ body__footer ][ box stack stack_recursive ][ background-color_secondary ]">
<footer id="footer"
class="[ body__footer ][ box stack stack_recursive ][ background-color_secondary ]">
<div class="cluster cluster_justify_space-between cluster_align_center">
<small>
<a rel="noopener noreferrer" href="https://creativecommons.org/licenses/by-sa/4.0/" rel="license" target="_blank">
<a rel="noopener noreferrer"
href="https://creativecommons.org/licenses/by-sa/4.0/"
rel="license"
target="_blank">
{{ println "&#127279;" (now.Format "2006") .Site.Title | safeHTML }}
</a>
<span class="js-theme-switcher"></span>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<header class="[ body__header ][ box ][ background-color_primary margin-top:0 ]"
<header class="[ body__header box ][ background-color_primary margin-top:0 ]"
id="header">
<div class="center center_max_x1.5">
<h1>
Expand Down
41 changes: 21 additions & 20 deletions layouts/section/archive.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{{ define "header" }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ end }}

{{ define "main" }}
<main class="[ center ][ stack ][ center_padding_gutters ]" id="main">
<article class="stack">
{{ with .Content }}
{{ . }}
{{ end }}

{{ range (.Parent.Pages.GroupByParam "category").Reverse }}
<h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
<main class="[ box ][ center stack ][ center_padding_gutters ]"
id="main">
<article class="stack">
{{ with .Content }}
{{ . }}
{{ end }}

{{ range (.Parent.Pages.GroupByParam "category").Reverse }}
<h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</article>
{{ partial "pagination" . }}
</main>
</ul>
{{ end }}
</article>
{{ partial "pagination" . }}
</main>
{{ end }}
2 changes: 1 addition & 1 deletion layouts/section/glossary.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ end }}

{{ define "main" }}
<main class="center center_padding_gutters center_max_x1.5"
<main class="[ box ][ center center_padding_gutters center_max_x1.5 ]"
id="main">
{{ $letters := split "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЭЮЯABCDEFGHIJKLMNOPQRSTUVWXYZ" "" }}
{{ $numbers := split "0123456789" "" }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/section/organisation.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ end }}

{{ define "main" }}
<main class="[ center ][ stack ][ center_padding_gutters ]"
<main class="[ box ][ center stack ][ center_padding_gutters ]"
id="main">

<article class="stack">
Expand All @@ -13,7 +13,7 @@
{{ end }}

<ol class="[ stack ][ list-style:none ]"
style="--stack-space: var(--s1);">
style="--space: var(--s1);">

{{ range .Pages }}
<li>
Expand Down
40 changes: 21 additions & 19 deletions layouts/section/section.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
{{ define "header" }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ partial "navigation" . }}
{{ partial "header" . }}
{{ end }}

{{ define "main" }}
<main class="[ center ][ stack ][ center_padding_gutters ]" id="main">
<article class="stack">
{{ with .Content }}
{{ . }}
<main class="[ box ][ center stack ][ center_padding_gutters ]"
id="main">
<article class="stack">
{{ with .Content }}
{{ . }}
{{ end }}
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}"
title="{{ .LinkTitle }}">
{{ .Title }}
</a>
<small>{{ .Description }}</small>
</li>
{{ end }}
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}" title="{{ .LinkTitle }}">
{{ .Title }}
</a>
<small>{{ .Description }}</small>
</li>
{{ end }}
</ul>
</article>
{{ partial "pagination" . }}
</main>
</ul>
</article>
{{ partial "pagination" . }}
</main>
{{ end }}

0 comments on commit 9b4664a

Please sign in to comment.