From f2021e8ce0ccb8eed38fb9603d4035071fdfa786 Mon Sep 17 00:00:00 2001 From: lucperkins Date: Wed, 24 Jul 2019 09:07:19 -0700 Subject: [PATCH] All for groups on cheatsheet Signed-off-by: lucperkins --- data/cheatsheet.yaml | 17 ++++++-- themes/falco-fresh/assets/cheatsheet.sass | 41 +++++++++++-------- .../layouts/shortcodes/cheatsheet.html | 26 ++++++++---- 3 files changed, 54 insertions(+), 30 deletions(-) diff --git a/data/cheatsheet.yaml b/data/cheatsheet.yaml index 8f3988230..30109def4 100644 --- a/data/cheatsheet.yaml +++ b/data/cheatsheet.yaml @@ -1,4 +1,13 @@ -forbidden-thing: - title: Do a thing -other-thing: - title: Some other thing +groups: +- name: Group 1 + cheats: + - filename: forbidden-thing + title: Do a thing + - filename: other-thing + title: A different thing + - filename: other-thing + title: A different thing +- name: Group 2 + cheats: + - filename: other-thing + title: Some other thing diff --git a/themes/falco-fresh/assets/cheatsheet.sass b/themes/falco-fresh/assets/cheatsheet.sass index 163204d73..fc5297b75 100644 --- a/themes/falco-fresh/assets/cheatsheet.sass +++ b/themes/falco-fresh/assets/cheatsheet.sass @@ -1,27 +1,32 @@ .cheatsheet - display: flex + &-group + &-title + font-size: 1.75rem + + & + & + margin-top: 2rem - +desktop - flex-flow: row nowrap - +mobile - flex-flow: column nowrap + &-cheats + display: flex + justify-content: space-between - flex-flow: row nowrap - justify-content: space-between + .cheat + padding: 1rem + background-color: $light - .cheat - padding: 1rem - background-color: $light + &-title + font-weight: 700 + font-size: 1.25rem +desktop - width: calc(50% - .25rem) - +mobile - width: 100% + flex-flow: row wrap - & + .cheat - margin-top: 1rem + .cheat + margin-bottom: 1rem + width: calc(50% - .25rem) - &-title - font-size: 1.25rem - font-weight: 700 + +mobile + flex-flow: column nowrap + .cheat + .cheat + margin-top: 1rem diff --git a/themes/falco-fresh/layouts/shortcodes/cheatsheet.html b/themes/falco-fresh/layouts/shortcodes/cheatsheet.html index ccdd5e911..920e1c0aa 100644 --- a/themes/falco-fresh/layouts/shortcodes/cheatsheet.html +++ b/themes/falco-fresh/layouts/shortcodes/cheatsheet.html @@ -1,14 +1,24 @@ -{{ $cheats := site.Data.cheatsheet }} +{{ $groups := site.Data.cheatsheet.groups }}
- {{ range $k, $v := $cheats }} - {{ $yaml := readFile (printf "cheatsheet/%s.yaml" $k) }} - {{ $title := $v.title | markdownify }} -
-

- {{ $title }} + {{ range $groups }} +

+

+ {{ .name }}

- {{ highlight $yaml "yaml" "" }} +
+ {{ range .cheats }} + {{ $yaml := readFile (printf "cheatsheet/%s.yaml" .filename) }} + {{ $title := .title | markdownify }} +
+

+ {{ $title }} +

+ + {{ highlight $yaml "yaml" "" }} +
+ {{ end }} +
{{ end }}