Term add card view

This commit is contained in:
Nuno Coração 2022-12-12 23:26:43 +00:00
parent 5d5dcaa7f8
commit b2045506dc
5 changed files with 105 additions and 37 deletions

View file

@ -101,7 +101,6 @@ enableCodeCopy = true
#showViews = false #showViews = false
#showLikes = false #showLikes = false
#showTableOfContents = true #showTableOfContents = true
#showCards = false
#groupByYear = false #groupByYear = false
#cardViewScreenWidth = false #cardViewScreenWidth = false
#cardView = false #cardView = false

View file

@ -100,9 +100,8 @@ defaultBackgroundImage = "/img/iceland.jpg"
showViews = true showViews = true
showLikes = true showLikes = true
showTableOfContents = true showTableOfContents = true
showCards = true
groupByYear = false groupByYear = false
cardView = true cardView = false
cardViewScreenWidth = false cardViewScreenWidth = false

View file

@ -61,8 +61,6 @@
{{ end }} {{ end }}
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $.Params.groupByYear | default ($.Site.Params.list.groupByYear | default true) }} {{ if $.Params.groupByYear | default ($.Site.Params.list.groupByYear | default true) }}
<h2 class="mt-12 mb-5 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300"> <h2 class="mt-12 mb-5 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
@ -132,4 +130,3 @@
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View file

@ -27,6 +27,8 @@
<div class="min-w-0 min-h-0 max-w-prose"> <div class="min-w-0 min-h-0 max-w-prose">
{{ .Content | emojify }} {{ .Content | emojify }}
</div> </div>
</section>
{{ end }}
<script> <script>
var oid = "views_{{ .File.Path }}" var oid = "views_{{ .File.Path }}"
var oid_likes = "likes_{{ .File.Path }}" var oid_likes = "likes_{{ .File.Path }}"
@ -34,8 +36,6 @@
{{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
</section>
{{ end }}
<section class="flex flex-wrap max-w-prose -mx-2 overflow-hidden"> <section class="flex flex-wrap max-w-prose -mx-2 overflow-hidden">
{{ range .Data.Terms }} {{ range .Data.Terms }}
<article class="w-full px-2 my-3 overflow-hidden sm:w-1/2 md:w-1/3 lg:w-1/4 xl:w-1/4"> <article class="w-full px-2 my-3 overflow-hidden sm:w-1/2 md:w-1/3 lg:w-1/4 xl:w-1/4">

View file

@ -27,6 +27,8 @@
<div class="min-w-0 min-h-0 max-w-prose"> <div class="min-w-0 min-h-0 max-w-prose">
{{ .Content | emojify }} {{ .Content | emojify }}
</div> </div>
</section>
{{ end }}
<script> <script>
var oid = "views_{{ .File.Path }}" var oid = "views_{{ .File.Path }}"
var oid_likes = "likes_{{ .File.Path }}" var oid_likes = "likes_{{ .File.Path }}"
@ -34,20 +36,91 @@
{{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
{{ if gt .Pages 0 }}
{{ if .Params.cardView | default (.Site.Params.term.cardView | default false) }}
{{ $cardViewScreenWidth := .Site.Params.term.cardViewScreenWidth}}
{{ if not $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
{{ if $cardViewScreenWidth }}
<section class="relative w-screen" style="left: calc(-50vw + 50%);">
<div class="flex flex-wrap pl-8 pr-8">
{{ else }}
<section class="w-full">
<div class="flex flex-wrap">
{{ end }}
{{ end }}
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
<h2 class="mt-12 mb-5 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
{{ .Key }}
</h2>
{{ else }}
{{ end }}
{{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
{{ if $cardViewScreenWidth}}
<section class="relative w-screen" style="left: calc(-50vw + 50%);">
<div class="flex flex-wrap pl-8 pr-8">
{{ else }}
<section class="w-full">
<div class="flex flex-wrap">
{{ end }}
{{ end }}
{{ range .Pages }}
{{ if $cardViewScreenWidth }}
<div class="flex flex-wrap w-full p-4 sm:w-1/2 md:w-1/3 xl:w-1/4 2xl:w-1/5">
{{ else }}
<div class="flex flex-wrap w-full p-4 sm:w-1/2 md:w-1/3">
{{ end }}
{{ partial "article-link-card.html" . }}
</div>
{{ end }}
{{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
</div>
</section> </section>
{{ end }} {{ end }}
<section class="mt-5 space-y-10 w-full">
{{ end }}
{{ if not $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
</div>
</section>
{{ end }}
{{ else }}
<section class="space-y-10 w-full">
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $.Params.groupByYear | default ($.Site.Params.list.groupByYear | default true) }} {{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
<h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300"> <h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
{{ .Key }} {{ .Key }}
</h2> </h2>
<hr class="border-dotted w-36 border-neutral-400" />
{{ end }} {{ end }}
{{ range .Pages }} {{ range .Pages }}
{{ partial "article-link.html" . }} {{ partial "article-link.html" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
</section> </section>
{{ end }}
{{ else }}
<section class="mt-10 prose dark:prose-invert">
<p class="py-8 border-t">
<em>{{ i18n "list.no_articles" | emojify }}</em>
</p>
</section>
{{ end }}
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }}
{{ end }}