diff options
Diffstat (limited to 'themes/blowfish/layouts/shortcodes')
26 files changed, 528 insertions, 0 deletions
diff --git a/themes/blowfish/layouts/shortcodes/alert.html b/themes/blowfish/layouts/shortcodes/alert.html new file mode 100644 index 0000000..e2001fe --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/alert.html @@ -0,0 +1,39 @@ +{{ if .IsNamedParams }} + {{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get "icon") ) }} + {{ $.Scratch.Set "cardColor" (.Get "cardColor") }} + {{ $.Scratch.Set "iconColor" (.Get "iconColor") }} + {{ $.Scratch.Set "textColor" (.Get "textColor") }} +{{ else }} + {{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get 0) ) }} +{{ end }} + + +<div + {{ if not ($.Scratch.Get "cardColor") }} + class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900" + {{ else }} + class="flex px-4 py-3 rounded-md" + style="background-color: {{ $.Scratch.Get "cardColor" }}" + {{ end }}> + + <span + {{ if not ($.Scratch.Get "iconColor") }} + class="text-primary-400 ltr:pr-3 rtl:pl-3 flex items-center" + {{ else }} + class="ltr:pr-3 rtl:pl-3 flex items-center" + style="color: {{ $.Scratch.Get "iconColor" }}" + {{ end }}> + + {{ partial "icon.html" ($.Scratch.Get "icon") }} + </span> + + <span + {{ if not ($.Scratch.Get "textColor") }} + class="dark:text-neutral-300" + {{ else }} + style="color: {{ $.Scratch.Get "textColor" }}" + {{ end }}> + + {{- .Inner | markdownify -}} + </span> +</div> diff --git a/themes/blowfish/layouts/shortcodes/article.html b/themes/blowfish/layouts/shortcodes/article.html new file mode 100644 index 0000000..68d74e7 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/article.html @@ -0,0 +1,9 @@ +{{ $parent := .Page.RelPermalink }} +<section class="space-y-10 w-full"> + {{ $RelPermalink := .Get "link" }} + {{ range ( where .Site.RegularPages "RelPermalink" $RelPermalink | first 1 ) }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link/simple.html" . }} + {{ end }} + {{end}} +</section>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/badge.html b/themes/blowfish/layouts/shortcodes/badge.html new file mode 100644 index 0000000..86d4e24 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/badge.html @@ -0,0 +1 @@ +{{ partial "badge.html" .Inner }} diff --git a/themes/blowfish/layouts/shortcodes/button.html b/themes/blowfish/layouts/shortcodes/button.html new file mode 100644 index 0000000..c6a4c36 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/button.html @@ -0,0 +1,8 @@ +<a + class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700" + {{ with .Get "href" }}href="{{ . }}"{{ end }} + {{ with .Get "target" }}target="{{ . }}"{{ end }} + role="button" +> + {{ .Inner }} +</a> diff --git a/themes/blowfish/layouts/shortcodes/carousel.html b/themes/blowfish/layouts/shortcodes/carousel.html new file mode 100644 index 0000000..8cc82d1 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/carousel.html @@ -0,0 +1,74 @@ +{{ $id := delimit (slice "carousel" (partial "functions/uid.html" .)) "-" }} +{{ $aspect := default "16-9" (.Get "aspectRatio") }} +{{ $interval := default "2000" (.Get "interval") }} + +{{ $page := .Page.Resources }} +{{ $imagesTemp := .Get "images" }} +{{ $imagesTemp = strings.TrimPrefix "{" $imagesTemp }} +{{ $imagesTemp = strings.TrimSuffix "}" $imagesTemp }} +{{ $imagesTemp := strings.Split $imagesTemp "," }} +{{ $images := slice}} +{{ range $imagesTemp }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $images = $images | append (resources.GetRemote .) }} + {{ else }} + {{ $images = $images | append ($page.Match .) }} + {{ end }} +{{ end }} + +<div id="{{ $id }}" class="relative" data-twe-carousel-init data-twe-ride="carousel"> + <div class="absolute right-0 bottom-0 left-0 z-[2] mx-[15%] mb-10 flex list-none justify-center p-0" + data-twe-carousel-indicators> + + {{ $num := 0 }} + {{ range $images }} + + <button type="button" data-twe-target="#{{ $id }}" data-twe-slide-to="{{ $num }}" {{ if eq $num 0 }} data-twe-carousel-active aria-current="true" {{ end }} + class="mx-[3px] box-content h-[3px] w-[30px] flex-initial cursor-pointer border-0 border-y-[10px] border-solid border-transparent bg-neutral bg-clip-padding p-0 -indent-[999px] opacity-50 transition-opacity duration-[600ms] ease-[cubic-bezier(0.25,0.1,0.25,1.0)] motion-reduce:transition-none" + aria-label="Slide {{ $num }}"></button> + + {{ $num = add $num 1 }} + {{ end }} + + </div> + <div class="relative w-full overflow-hidden after:clear-both after:block after:content-['']"> + + {{ $num := 0 }} + {{ range $images }} + + <div class="relative float-left -mr-[100%] {{ if not (eq $num 0) }} hidden {{ end }} w-full transition-transform duration-[{{ $interval }}ms] ease-in-out motion-reduce:transition-none" + data-twe-carousel-item {{ if eq $num 0 }} data-twe-carousel-active {{ end }}> + <div class="ratio-{{ $aspect }} single_hero_background"> + <img src="{{ .RelPermalink }}" class="block absolute top-0 object-cover w-full h-full nozoom" alt="carousel image {{$num}}"/> + </div> + </div> + + {{ $num = add $num 1 }} + {{ end }} + + </div> + <button + class="absolute top-0 bottom-0 left-0 z-[2] flex w-[15%] items-center justify-center border-0 bg-none p-0 text-center text-white opacity-50 transition-opacity duration-150 ease-[cubic-bezier(0.25,0.1,0.25,1.0)] hover:text-white hover:no-underline hover:opacity-90 hover:outline-none focus:text-white focus:no-underline focus:opacity-90 focus:outline-none motion-reduce:transition-none" + type="button" data-twe-target="#{{ $id }}" data-twe-slide="prev"> + <span class="inline-block h-8 w-8"> + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="4.5" + stroke="currentColor" class="h-6 w-6"> + <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" /> + </svg> + </span> + <span + class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]">Previous</span> + </button> + <button + class="absolute top-0 bottom-0 right-0 z-[1] flex w-[15%] items-center justify-center border-0 bg-none p-0 text-center text-white opacity-50 transition-opacity duration-150 ease-[cubic-bezier(0.25,0.1,0.25,1.0)] hover:text-white hover:no-underline hover:opacity-90 hover:outline-none focus:text-white focus:no-underline focus:opacity-90 focus:outline-none motion-reduce:transition-none" + type="button" data-twe-target="#{{ $id }}" data-twe-slide="next"> + <span class="inline-block h-8 w-8"> + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="4.5" + stroke="currentColor" class="h-6 w-6"> + <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /> + </svg> + </span> + <span + class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]">Nextsads</span> + </button> +</div> diff --git a/themes/blowfish/layouts/shortcodes/chart.html b/themes/blowfish/layouts/shortcodes/chart.html new file mode 100644 index 0000000..1e17275 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/chart.html @@ -0,0 +1,12 @@ +{{ $id := delimit (slice "chart" (partial "functions/uid.html" .)) "-" }} +<div class="chart"> + <canvas id="{{ $id }}"></canvas> + <script type="text/javascript"> + window.addEventListener("DOMContentLoaded", (event) => { + const ctx = document.getElementById("{{ $id }}"); + const chart = new Chart(ctx, { + {{ .Inner | safeJS }} + }); + }); + </script> +</div> diff --git a/themes/blowfish/layouts/shortcodes/figure.html b/themes/blowfish/layouts/shortcodes/figure.html new file mode 100644 index 0000000..4f641f3 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/figure.html @@ -0,0 +1,55 @@ +{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} +{{ if .Get "default" }} + {{ template "_internal/shortcodes/figure.html" . }} +{{ else }} + {{ $url := urls.Parse (.Get "src") }} + {{ $altText := .Get "alt" }} + {{ $caption := .Get "caption" }} + {{ $href := .Get "href" }} + {{ $class := .Get "class" }} + {{ $target := .Get "target" }} + {{ $nozoom := .Get "nozoom" | default false }} + {{ if findRE "^https?" $url.Scheme }} + <figure> + <img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" /> + {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} + </figure> + {{ else }} + {{ $resource := "" }} + {{ if $.Page.Resources.GetMatch ($url.String) }} + {{ $resource = $.Page.Resources.GetMatch ($url.String) }} + {{ else if resources.GetMatch ($url.String) }} + {{ $resource = resources.Get ($url.String) }} + {{ end }} + {{ with $resource }} + <figure {{ with $class }}class="{{ . }}"{{ end }}> + {{ with $href }}<a href="{{ . }}" {{ with $target }}target="{{ . }}"{{ end }}>{{ end }} + {{ if $disableImageOptimization }} + <img + class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" + src="{{ .RelPermalink }}" + alt="{{ $altText }}" + /> + {{ else }} + <img + class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" + srcset=" + {{ (.Resize "330x").RelPermalink }} 330w, + {{ (.Resize "660x").RelPermalink }} 660w, + {{ (.Resize "1024x").RelPermalink }} 1024w, + {{ (.Resize "1320x").RelPermalink }} 2x" + src="{{ (.Resize "660x").RelPermalink }}" + alt="{{ $altText }}" + /> + {{ end }} + {{ if $href }}</a>{{ end }} + {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} + </figure> + {{ else }} + <figure> + <img class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" /> + {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} + </figure> + {{ end }} + {{ end }} +{{ end }} diff --git a/themes/blowfish/layouts/shortcodes/gallery.html b/themes/blowfish/layouts/shortcodes/gallery.html new file mode 100644 index 0000000..c01b48f --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/gallery.html @@ -0,0 +1,5 @@ +{{ $id := delimit (slice "gallery" (partial "functions/uid.html" .)) "-" }} + +<div id="{{ $id }}" class="gallery"> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/github.html b/themes/blowfish/layouts/shortcodes/github.html new file mode 100644 index 0000000..fc0c571 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/github.html @@ -0,0 +1,67 @@ +{{ $id := delimit (slice "github" (partial "functions/uid.html" .)) "-" }} +{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}} +{{- $githubData := getJSON ($githubURL) -}} +{{- $githubColors := .Site.Data.githubColors -}} +{{- with $githubData -}} + +<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer"> + <div + class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"> + + <div class="flex items-center"> + <span class="text-2xl text-neutral-800 dark:text-neutral" style="margin-right:10px;"> + {{ partial "icon.html" "github" }} + </span> + <div + id="{{ $id }}-full_name" + class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ .full_name | markdownify | emojify }} + </div> + </div> + + <p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral"> + {{ .description | markdownify | emojify }} + </p> + + <div class="m-0 mt-2 flex items-center"> + + <span class="mr-1 inline-block h-3 w-3 rounded-full" + style="background-color: {{ if .language }} {{- index $githubColors .language -}} {{ else }} #0077b6 {{ end }}"></span> + <div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ if .language }} {{ .language }} {{ else }} null {{ end }} + </div> + + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "star" }} + </span> + <div id="{{ $id }}-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .stargazers_count }} + </div> + + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "fork" }} + </span> + <div id="{{ $id }}-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .forks }} + </div> + + </div> + + </div> + <script> + fetch({{ $githubURL }}, { + headers: new Headers({ + 'User-agent': 'Mozilla/4.0 Custom User Agent' + }) + }) + .then(response => response.json()) + .then(data => { + document.getElementById('{{ $id }}-full_name').innerHTML = data.full_name; + document.getElementById('{{ $id }}-description').innerHTML = data.description; + document.getElementById('{{ $id }}-stargazers').innerHTML = data.stargazers_count; + document.getElementById('{{ $id }}-forks').innerHTML = data.forks; + }) + .catch(error => console.error(error)) + </script> +</a> +{{- end -}}
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/gitlab.html b/themes/blowfish/layouts/shortcodes/gitlab.html new file mode 100644 index 0000000..1fbe70e --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/gitlab.html @@ -0,0 +1,57 @@ +{{ $id := delimit (slice "gitlab" (partial "functions/uid.html" .)) "-" }} +{{- $gitlabURL := print (default "https://gitlab.com/" (.Get "baseURL")) "api/v4/projects/" (.Get "projectID") -}} + +{{- $gitLabData := getJSON ($gitlabURL) -}} +{{- with $gitLabData -}} + +<a id="{{ $id }}" target="_blank" href="{{ .web_url }}" class="cursor-pointer"> + <div class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"> + + <div class="flex items-center"> + <span class="text-2xl text-neutral-800 dark:text-neutral" style="margin-right:10px;"> + {{ partial "icon.html" "gitlab" }} + </span> + <div id="{{ $id }}-name_with_namespace" class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ .name_with_namespace | markdownify | emojify }} + </div> + </div> + + <p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral"> + {{ .description | markdownify | emojify }} + </p> + + <div class="m-0 mt-2 flex items-center"> + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "star" }} + </span> + <div id="{{ $id }}-star_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .star_count }} + </div> + + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "fork" }} + </span> + <div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .forks_count }} + </div> + + </div> + + </div> + <script> + fetch({{ $gitlabURL }}, { + headers: new Headers({ + 'User-agent': 'Mozilla/4.0 Custom User Agent' + }) + }) + .then(response => response.json()) + .then(data => { + document.getElementById('{{ $id }}-name_with_namespace').innerHTML = data.name_with_namespace; + document.getElementById('{{ $id }}-description').innerHTML = data.description; + document.getElementById('{{ $id }}-star_count').innerHTML = data.star_count; + document.getElementById('{{ $id }}-forks_count').innerHTML = data.forks_count; + }) + .catch(error => console.error(error)) + </script> +</a> +{{- end -}} diff --git a/themes/blowfish/layouts/shortcodes/icon.html b/themes/blowfish/layouts/shortcodes/icon.html new file mode 100644 index 0000000..7203424 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/icon.html @@ -0,0 +1,8 @@ +{{ $icon := resources.Get (printf "icons/%s.svg" ($.Get 0)) }} +{{ if $icon }} + <span class="relative inline-block align-text-bottom icon"> + {{ $icon.Content | safeHTML }} + </span> +{{ else }} + {{ errorf `[BLOWFISH] Shortcode "icon" error in "%s": Resource "%s" not found. Check the path is correct or remove the shortcode.` .Page.Path (printf "icons/%s.svg" ($.Get 0)) }} +{{ end }} diff --git a/themes/blowfish/layouts/shortcodes/katex.html b/themes/blowfish/layouts/shortcodes/katex.html new file mode 100644 index 0000000..a4160bf --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/katex.html @@ -0,0 +1 @@ +{{/* Nothing to see here */}} diff --git a/themes/blowfish/layouts/shortcodes/keyword.html b/themes/blowfish/layouts/shortcodes/keyword.html new file mode 100644 index 0000000..8e6528d --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/keyword.html @@ -0,0 +1,13 @@ +{{ $icon := .Get "icon"}} +<div class="flex mt-2"> +<span + class="rounded-full bg-primary-500 dark:bg-primary-400 text-neutral-50 dark:text-neutral-800 px-1.5 py-[1px] text-xs font-normal" +> + <span class="flex flex-row items-center"> + {{if $icon}} + <span class="mr-1">{{ partial "icon" $icon }}</span> + {{ end }} + <span> {{- .Inner | markdownify -}} </span> + </span> +</span> +</div>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/keywordList.html b/themes/blowfish/layouts/shortcodes/keywordList.html new file mode 100644 index 0000000..22d89c6 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/keywordList.html @@ -0,0 +1 @@ +<div class="flex flex-row flex-wrap items-center space-x-2">{{- .Inner -}}</div> diff --git a/themes/blowfish/layouts/shortcodes/lead.html b/themes/blowfish/layouts/shortcodes/lead.html new file mode 100644 index 0000000..28791cd --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/lead.html @@ -0,0 +1,3 @@ +<div class="lead text-neutral-500 dark:text-neutral-400 !mb-9 text-xl"> + {{ .Inner | markdownify }} +</div> diff --git a/themes/blowfish/layouts/shortcodes/list.html b/themes/blowfish/layouts/shortcodes/list.html new file mode 100644 index 0000000..f46e96e --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/list.html @@ -0,0 +1,47 @@ + +{{ $limit := .Get "limit" | default 1 }} +{{ $title := .Get "title" | default (i18n "shortcode.recent_articles" | emojify) }} +{{ $parent := .Page.RelPermalink }} +{{ $cardView := .Get "cardView" }} +{{ $where := .Get "where" }} +{{ $value := .Get "value" }} +<h2 class="mt-20 text-2xl font-extrabold mb-10">{{ $title }}</h2> + + +{{ if $cardView | default false}} + +<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3"> + {{ if $where }} + {{ range ( where .Site.RegularPages $where $value | first $limit ) }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{end}} + {{ else }} + {{ range .Site.RegularPages | first $limit }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{end}} + {{ end }} +</section> + +{{ else }} + +<section class="space-y-10 w-full mt-10 mb-10"> + {{ if $where }} + {{ range ( where .Site.RegularPages $where $value | first $limit ) }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link/simple.html" . }} + {{ end }} + {{end}} + {{ else }} + {{ range .Site.RegularPages | first $limit }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link/simple.html" . }} + {{ end }} + {{end}} + {{ end }} +</section> + +{{ end }} diff --git a/themes/blowfish/layouts/shortcodes/ltr.html b/themes/blowfish/layouts/shortcodes/ltr.html new file mode 100644 index 0000000..d3c4a29 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/ltr.html @@ -0,0 +1,3 @@ +<div dir="ltr" class="text-left"> +{{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/mdimporter.html b/themes/blowfish/layouts/shortcodes/mdimporter.html new file mode 100644 index 0000000..28b24fe --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/mdimporter.html @@ -0,0 +1,6 @@ +{{ $url := .Get "url"}} +{{ with resources.GetRemote (printf $url) }} +{{ .Content | markdownify }} +{{ else }} +{{ errorf "Mardown Importer Shortcode - Unable to get remote resource" . }} +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/mermaid.html b/themes/blowfish/layouts/shortcodes/mermaid.html new file mode 100644 index 0000000..7246bf8 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/mermaid.html @@ -0,0 +1,3 @@ +<div class="mermaid" align="center"> + {{ .Inner }} +</div> diff --git a/themes/blowfish/layouts/shortcodes/rtl.html b/themes/blowfish/layouts/shortcodes/rtl.html new file mode 100644 index 0000000..2947a9d --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/rtl.html @@ -0,0 +1,3 @@ +<div dir="rtl" class="text-right"> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/screenshot.html b/themes/blowfish/layouts/shortcodes/screenshot.html new file mode 100644 index 0000000..39640ac --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/screenshot.html @@ -0,0 +1,22 @@ +{{ if .Get "src" }} + {{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }} + <figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> + {{- if .Get "href" -}} + <a href="{{ .Get "href" }}"> + {{- end -}} + <img src="{{ $image.RelPermalink }}" + {{- if or (.Get "alt") (.Get "caption") }} + alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}" + {{- end -}} + width="100%" + height="auto" + style="max-width:{{ div $image.Width 2 }}px; max-height:{{ div $image.Height 2 }}px;" + /> + {{- if .Get "href" }}</a>{{ end -}} + {{- if .Get "caption" -}} + <figcaption> + {{- .Get "caption" | markdownify -}} + </figcaption> + {{- end }} + </figure> +{{ end }} diff --git a/themes/blowfish/layouts/shortcodes/swatches.html b/themes/blowfish/layouts/shortcodes/swatches.html new file mode 100644 index 0000000..322db53 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/swatches.html @@ -0,0 +1,14 @@ +<div class="flex justify-between"> + <span + class="w-full py-6 mr-3 rounded-md" + {{ with .Get 0 }}style="background-color: {{ . }}"{{ end }} + ></span> + <span + class="w-full py-6 mr-3 rounded-md" + {{ with .Get 1 }}style="background-color: {{ . }}"{{ end }} + ></span> + <span + class="w-full py-6 mr-3 rounded-md" + {{ with .Get 2 }}style="background-color: {{ . }}"{{ end }} + ></span> +</div> diff --git a/themes/blowfish/layouts/shortcodes/timeline.html b/themes/blowfish/layouts/shortcodes/timeline.html new file mode 100644 index 0000000..27ee729 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/timeline.html @@ -0,0 +1,3 @@ +<ol class="border-l-2 list-none border-primary-500 dark:border-primary-300"> + {{- .Inner -}} +</ol>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/timelineItem.html b/themes/blowfish/layouts/shortcodes/timelineItem.html new file mode 100644 index 0000000..8297b6c --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/timelineItem.html @@ -0,0 +1,32 @@ +{{ $icon := .Get "icon" | default "check" }} +{{ $header := .Get "header" }} +{{ $badge := .Get "badge" }} +{{ $subheader := .Get "subheader" }} +{{ $text := .Get "text" }} +<li class="list-none"> + <div class="flex flex-start"> + <div class="bg-primary-500 dark:bg-primary-300 text-neutral-50 dark:text-neutral-700 min-w-[30px] h-8 text-2xl flex items-center justify-center rounded-full -ml-12 mt-5"> + {{ partial "icon" $icon }} + </div> + <div class="block p-6 rounded-lg shadow-2xl min-w-full ml-6 mb-10 break-words"> + <div class="flex justify-between"> + {{ if $header }} + <h2 class="mt-0"> + {{ $header }} + </h2> + {{ end }} + {{ if $badge }} + <h3 class=""> + {{ partial "badge" $badge}} + </h3> + {{ end }} + </div> + {{ if $subheader }} + <h4 class="mt-0"> + {{ $subheader }} + </h4> + {{ end }} + <p class="text-gray-700 mb-6">{{- .Inner -}}</p> + </div> + </div> +</li> diff --git a/themes/blowfish/layouts/shortcodes/typeit.html b/themes/blowfish/layouts/shortcodes/typeit.html new file mode 100644 index 0000000..2cc94e1 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/typeit.html @@ -0,0 +1,37 @@ +{{- $content := split .Inner "\n" -}} +{{- $initialString := .Get "initialString" | default "" -}} +{{- $speed := .Get "speed" | default 100 -}} +{{- $lifeLike := .Get "lifeLike" | default false -}} +{{- $startDelay := .Get "startDelay" | default 0 -}} +{{- $breakLines := .Get "breakLines" | default true -}} +{{- $waitUntilVisible := .Get "waitUntilVisible" | default true -}} +{{- $loop := .Get "loop" | default false -}} + +{{- $classList := slice -}} +{{- with .Get "class" -}} + {{- $classList = $classList | append . -}} +{{- end -}} +{{- $tag := .Get "tag" | default "div" -}} + +{{ $id := delimit (slice "typeit" (partial "functions/uid.html" .)) "-" }} + +{{- $attrs := printf `id="%v"` $id -}} +{{- with $classList -}} + {{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}} +{{- end -}} + +{{ printf `<%v %v>%s</%v>` $tag $attrs $initialString $tag | safeHTML }} + +<script> + document.addEventListener("DOMContentLoaded", function () { + new TypeIt("#{{ $id }}", { + strings: {{ $content }}, + speed: {{ $speed }}, + lifeLike: {{ $lifeLike }}, + startDelay: {{ $startDelay }}, + breakLines: {{ $breakLines }}, + waitUntilVisible: {{ $waitUntilVisible }}, + loop: {{ $loop }} + }).go(); + }); +</script>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/youtubeLite.html b/themes/blowfish/layouts/shortcodes/youtubeLite.html new file mode 100644 index 0000000..4375eb3 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/youtubeLite.html @@ -0,0 +1,5 @@ +{{- $id := .Get "id" | default "SgXhGb-7QbU" -}} +{{- $label := .Get "id" | default "Blowfish" -}} +{{- $params := .Get "params" -}} + +<lite-youtube videoid="{{ $id }}" playlabel="{{ $label }}" params="{{ $params }}"></lite-youtube> |