commit 796a0ab998884ccd5f5c4df970ebdeccbdcfe2f5 parent 068afc804c8661a0a438a4dd119a85c1e5d3c7a2 Author: Yohanes Bandung <bandungpenting@gmail.com> Date: Tue, 28 Apr 2020 18:07:16 +0700 style: notes responsive Diffstat:
| M | assets/content.scss | | | 17 | +++++++++++++++++ |
| M | layouts/_default/list.html | | | 11 | +---------- |
| M | layouts/index.html | | | 17 | +++++------------ |
| A | layouts/partials/post/notes-item.html | | | 23 | +++++++++++++++++++++++ |
4 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/assets/content.scss b/assets/content.scss @@ -52,4 +52,21 @@ } } } +} + +.notes { + & > p { + margin-top: 5px; + } + margin-bottom: 2em; + @media (max-width: 599px) { + &__title { + margin: 10px 0 0; + &__separator { + display: none; + } + display: flex; + flex-direction: column; + } + } } \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html @@ -8,16 +8,7 @@ {{ if eq .Type "notes" }} {{ range (where .Site.RegularPages "Type" "notes") }} - {{ $dateformat := .Date.Format "2006-01-02" }} - {{ $idslug := (print $dateformat "-" .Title) | urlize }} - <h4 id={{ $idslug }}> - <time>{{ .Date.Format "02 Jan 2006" }}</time> - {{ with .Title}} - - {{ . }} - {{ end }} - <a href="#{{ $idslug }}">#</a> - </h4> - <p>{{ .Content }}</p> + {{ partial "post/notes-item.html" . }} {{ end }} {{ else }} {{ range .Paginator.Pages }} diff --git a/layouts/index.html b/layouts/index.html @@ -21,18 +21,11 @@ <hr> <h2>Notes:</h2> - {{ range first 5 (where .Site.RegularPages "Type" "notes") }} - {{ $dateformat := .Date.Format "2006-01-02" }} - {{ $idslug := (print $dateformat "-" .Title) | urlize }} - <h4 id={{ $idslug }}> - <time>{{ .Date.Format "02 Jan 2006" }}</time> - {{ with .Title}} - - {{ . }} - {{ end }} - <a href="/notes/#{{ $idslug }}">#</a> - </h4> - <p>{{ .Content }}</p> - {{ end }} + <div class="listing"> + {{ range first 5 (where .Site.RegularPages "Type" "notes") }} + {{ partial "post/notes-item.html" . }} + {{ end }} + </div> {{ $notesURL := "/notes" | absURL }} <p class="main__more"><a href={{ $notesURL }} class="button">More Notes ⤳</a></p> diff --git a/layouts/partials/post/notes-item.html b/layouts/partials/post/notes-item.html @@ -0,0 +1,22 @@ +{{ $dateformat := .Date.Format "2006-01-02" }} +{{ $idslug := (print $dateformat "-" .Title) | urlize }} +<div class="notes"> + <h4 class="notes__title" id={{ $idslug }}> + <span> + <time class="notes__title__date"> + {{ .Date.Format "02 Jan 2006" }} + </time> + {{ if .Title }} + {{ else }} + <a href="#{{ $idslug }}">#</a></span> + {{ end }} + </span> + {{ with .Title}} + <span class="notes__title__separator"> - </span> + {{ end }} + {{ with .Title}} + <span class="notes__title__title">{{ . }} <a href="#{{ $idslug }}">#</a></span> + {{ end }} + </h4> + {{ .Content }} +</div>+ \ No newline at end of file