♻️ Refactor: Use universal json and move styles out of line

This commit is contained in:
Served Smart
2025-06-22 04:08:11 +02:00
parent 8d940881a4
commit cc2e90233a
9 changed files with 44 additions and 1627 deletions

View File

@@ -1,7 +1,6 @@
{{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }}
{{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}}
{{- $codebergData := resources.GetRemote $codebergURL | transform.Unmarshal -}}
{{- $codebergColors := .Site.Data.codebergColors -}}
{{- with $codebergData -}}
<div class="codeberg-card-wrapper">
<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer">
@@ -23,13 +22,12 @@
</p>
<div class="m-0 mt-2 flex items-center">
{{ $className := "color-repo-fallback" }}
{{ if .language }}
{{ $className = printf "color-repo-%s" (md5 .language) }}
{{ end }}
<span
class="mr-1 inline-block h-3 w-3 rounded-full"
style="background-color: {{ if .language }}
{{- index $codebergColors .language -}}
{{ else }}
#0077b6
{{ end }}"></span>
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
</div>